From: Harish on
How to generate random numbers in the interval [0 1] ?
From: Steven Lord on

"Harish " <harish.campus(a)gmail.com> wrote in message
news:hpbicj$rrl$1(a)fred.mathworks.com...
> How to generate random numbers in the interval [0 1] ?

Assuming you want to use the uniform distribution, use RAND. If you want
some other distribution, look at the random number generating functions in
Statistics Toolbox.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ


From: ImageAnalyst on
Harish should also be aware that there is a help facility available in
MATLAB, where this kind of basic question would have been answered
very very promptly, much quicker than asking via the newsgroup. There
is a blue question mark icon, as well as a "Help" pulldown menu item
on the main menu. Perhaps Harish somehow missed them, but they're
very useful to know about.
From: Derek O'Connor on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <72c7b342-e781-44cd-986e-91d68c0808c6(a)x38g2000vbx.googlegroups.com>...
> Harish should also be aware that there is a help facility available in
> MATLAB, where this kind of basic question would have been answered
> very very promptly, much quicker than asking via the newsgroup. There
> is a blue question mark icon, as well as a "Help" pulldown menu item
> on the main menu. Perhaps Harish somehow missed them, but they're
> very useful to know about.

--------

Let's not be too Harsh on Harish.

Does RAND return a floating point number in (0,1), (0,1], [0,1), or [0,1]?

What seed(state) for RAND will give 0 or 1?

>>help rand gave me no help on this question.

Derek O'Connor.
From: Peter Perkins on
On 4/5/2010 1:47 AM, Derek O'Connor wrote:

> Does RAND return a floating point number in (0,1), (0,1], [0,1), or [0,1]?
>
> What seed(state) for RAND will give 0 or 1?
>
>>> help rand gave me no help on this question.

In the current release,

>> help rand
RAND Uniformly distributed pseudorandom numbers.
R = RAND(N) returns an N-by-N matrix containing pseudorandom values drawn
from the standard uniform distribution on the open interval(0,1).
[snip]