http://www.mathworks.com/matlabcentral/newsreader/view_thread/283269
MATLAB Central Newsreader  random numbers
Feed for thread: random numbers
enus
©19942015 by MathWorks, Inc.
webmaster@mathworks.com
MATLAB Central Newsreader
http://blogs.law.harvard.edu/tech/rss
60
MathWorks
http://www.mathworks.com/images/membrane_icon.gif

Fri, 28 May 2010 00:52:06 +0000
random numbers
http://www.mathworks.com/matlabcentral/newsreader/view_thread/283269#749569
Wendy
Hi all, <br>
<br>
I want to generate 30 random numbers that are between 0 and 1, and these 30 numbers have to add up to 1. Does anyone know how to generate random numbers that add up to a certain value?<br>
<br>
Thank you in advance,<br>
Wendy

Fri, 28 May 2010 00:59:26 +0000
Re: random numbers
http://www.mathworks.com/matlabcentral/newsreader/view_thread/283269#749570
Walter Roberson
Wendy wrote:<br>
<br>
> I want to generate 30 random numbers that are between 0 and 1, and these <br>
> 30 numbers have to add up to 1. Does anyone know how to generate random <br>
> numbers that add up to a certain value?<br>
<br>
See yesterday's thread (active today as well), "random values".

Fri, 28 May 2010 01:59:05 +0000
Re: random numbers
http://www.mathworks.com/matlabcentral/newsreader/view_thread/283269#749572
Roger Stafford
"Wendy " <wlq121@gmail.com> wrote in message <htn43m$3t0$1@fred.mathworks.com>...<br>
> Hi all, <br>
> <br>
> I want to generate 30 random numbers that are between 0 and 1, and these 30 numbers have to add up to 1. Does anyone know how to generate random numbers that add up to a certain value?<br>
> <br>
> Thank you in advance,<br>
> Wendy<br>
<br>
This is straight out of Wikipedia.<br>
<br>
r = diff([0;sort(rand(30,1));1]);<br>
<br>
Roger Stafford

Fri, 28 May 2010 02:08:04 +0000
Re: random numbers
http://www.mathworks.com/matlabcentral/newsreader/view_thread/283269#749574
Roger Stafford
"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <htn818$6kj$1@fred.mathworks.com>...<br>
> .......<br>
> r = diff([0;sort(rand(30,1));1]);<br>
> ......<br>
<br>
Sorry. I meant to write<br>
<br>
r = diff([0;sort(rand(29,1));1]);<br>
<br>
Roger Stafford