help-octave
[Top][All Lists]

 From: John W. Eaton Subject: Re: bad random numbers Date: Tue, 13 Jul 1999 20:03:51 -0500 (CDT)

```On 13-Jul-1999, Mike Miller <address@hidden> wrote:

| On Tue, 13 Jul 1999, John W. Eaton wrote:
|
| > | The results you produced show the same problem and it *is* a serious
| > | problem.
| >
| > It is not a serious problem for me, because I don't expect that there
| > is any reason to believe that the sequence of numbers obtained by
| > running
| >
| >   while true; do echo rand | octave -qf; done
| >
| > should have any special properties.
|
| Like being random?  My "reason to believe" was that Octave documentation
| states that a seed is produced from the system clock everytime Octave
| starts.  This usually means that we get a different random number every
| time we start the program.  That isn't what happens.

You do get a different sequence of random numbers each time Octave
starts.  Well, OK, the sequence of seeds can repeat after a month, but
I don't think that really matters.

The manual actually says:

Normally, `rand' and `randn' obtain their initial seeds from the
system clock, so that the sequence of random numbers is not the same
each time you run Octave.  If you really do need for to reproduce a
sequence of numbers exactly, you can set the seed to a specific
value.

So it claims that the sequence of random numbers is not the same from
run to run, not that the sequence of numbers generated by the while
loop above has any special properties.

FWIW, I can't think of a good way to make that while loop generate a
sequence of numbers that has the properies of a sequence produced by a
good random number generator.  If anyone can, then I'd appreciate it
if you'd submit a patch.

Thanks,

jwe

---------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.  To ensure