From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: how to generate random variable with constraint?
Date: Tue, 20 Jul 2010 18:23:20 +0000 (UTC)
Organization: Xoran Technologies
Lines: 15
Message-ID: <i24pio$k5f$>
References: <i22vhv$frn$> <i24er8$7qs$> <Jbj1o.16614$Bh2.16201@newsfe04.iad> <i24fnn$6pu$> <YKj1o.92592$Lj2.82402@newsfe05.iad> <i24i60$gfp$> <i24nq0$oat$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1279650200 20655 (20 Jul 2010 18:23:20 GMT)
NNTP-Posting-Date: Tue, 20 Jul 2010 18:23:20 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1440443
Xref: comp.soft-sys.matlab:654671

"Roger Stafford" <> wrote in message <i24nq0$oat$>...

> - - - - - - - - -
>   Matt, I'm in agreement with John and Walter on this.  Your two solutions are not good ones to give as an answer even if Jay did not give specific details as to the desired distribution.
>   For example in your second method with five variables it is impossible for the fifth one to exceed 1/2 even though doing so would easily be compatible with Jay's constraint.

Roger- You're right. I had a mistake. What I really meant to give was this:

A=cumsum(rand(1,6)); A=A/A(end); A(end)=[];

I reran John's 2D test on this and find that it covers the correct triangular area, though slightly less uniformly than the sorting method.

Again, though, for me, this was all just an exercise in seeing if we could get something nearly as good using cheaper summations instead of sorting.