Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!news2.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!newsfe18.iad.POSTED!7564ea0f!not-for-mail
From: Walter Roberson <roberson@hushmail.com>
User-Agent: Thunderbird 2.0.0.24 (Macintosh/20100228)
MIME-Version: 1.0
Newsgroups: comp.soft-sys.matlab
Subject: Re: how to generate random variable with constraint?
References: <i22vhv$frn$1@fred.mathworks.com> <i2308i$7p$1@fred.mathworks.com>
In-Reply-To: <i2308i$7p$1@fred.mathworks.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 17
Message-ID: <Ob91o.39684$YX3.15357@newsfe18.iad>
NNTP-Posting-Host: 24.79.143.47
X-Complaints-To: internet.abuse@sjrb.ca
X-Trace: newsfe18.iad 1279598446 24.79.143.47 (Tue, 20 Jul 2010 04:00:46 UTC)
NNTP-Posting-Date: Tue, 20 Jul 2010 04:00:46 UTC
Date: Mon, 19 Jul 2010 23:00:45 -0500
Xref: news.mathworks.com comp.soft-sys.matlab:654448

someone wrote:
> "jay " <ssjzdl@gmail.com> wrote in message 
> <i22vhv$frn$1@fred.mathworks.com>...
>> I need to generate 5 random variables between [0,1], let's say a, b, 
>> c, d, e. The constraint is that a<b<c<d<e. How to make this happen? 
>> Please advise. thanks
> 
> doc rand
> doc sort
> 
> It seems to me that the only way 5 random numbers wouldn't satisfy that 
> constraint is if 2 or more of them are equal.  A very unlikely event.

Roger Stafford has discussed some limitations on generating random 
variables with constraints -- if it is done incorrectly, the values tend 
to cluster towards the middle instead of uniformly distributed. I think 
sorting was okay, but I'd have to find the previous threads to be sure.