Home > Archive > Matlab > June 2007 > Re: How to define the interval of
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Re: How to define the interval of
|
|
| John D'Errico 2007-06-29, 7:14 pm |
| Mike wrote:
>
>
> Hi
> I am trying to use "Rand" to generate a random array, I know the
> defaut interval of Rand is (0.0,0.1), so how can I make the
> interval
> of Rand (-0.01,0.01)?
>
> Thanks
>
> Mike
Actually, the upper bound for rand is 1,
not 0.1.
What would happen if you multiplied the
output from rand by some constant, say
..02?
Would the result still be random? What
would its range be?
Now, suppose you subtracted some other
constant from this? Say 0.01?
What would happen?
HTH,
John
| |
| Walter Roberson 2007-06-29, 7:14 pm |
| In article <ef5c163.1@webcrossing.raydaftYaTP>,
John D'Errico <woodchips@rochester.rr.com> wrote:
>Actually, the upper bound for rand is 1,
>not 0.1.
Actually the upper bound for rand() is 1-2^(-53)
for the 'twister' and 'state' generators, and 1-1/(2^31-1)
for the 'seed' generator.
The lower bounds are not 0 but rather 1 minus the respective upper
bounds.
--
If you lie to the compiler, it will get its revenge. -- Henry Spencer
|
|
|
|
|