[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bad random numbers
From: |
Jim Van Zandt |
Subject: |
Re: bad random numbers |
Date: |
Tue, 13 Jul 1999 08:52:01 -0400 |
Mike -
I tried this, to extract the 1,1 element of several matrices in a row:
for x in `seq 100`; do ./makerand|awk 'NR==3{print $1; exit}'>>values;
done
This took about 10 seconds to run on my machine. The output starts
like this:
vanzandt-pc:/tmp$ head -15 values
0.61386
0.61386
0.61386
0.61386
0.61386
0.61386
0.61386
0.61386
0.61386
0.61386
0.61386
0.61386
0.69625
0.69625
0.69625
The number continued to grow in stairstep fashion until it wrapped
around to zero. Apparently, the random number generator is
initialized from the system clock, and advances by 0.082390 each
second.
I suggest that the random number generator should be initialized using
the microseconds field of the struct returned by gettimeofday(), if
available (so it's more likely to start differently from one run to
the next), and that one number should be discarded after
initialization (to destroy the correlation between one run and the
next).
- Jim Van Zandt
---------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL. To ensure
that development continues, see www.che.wisc.edu/octave/giftform.html
Instructions for unsubscribing: www.che.wisc.edu/octave/archive.html
---------------------------------------------------------------------
- Re: bad random numbers, (continued)
- Re: bad random numbers, A+A Adler, 1999/07/13
- Re: bad random numbers, Mike Miller, 1999/07/13
- Re: bad random numbers, John Judge, 1999/07/13
- Re: bad random numbers, lash, 1999/07/13
- Re: bad random numbers, Mike Miller, 1999/07/14
- Re: bad random numbers, lash, 1999/07/14
- Re: bad random numbers, Jim Van Zandt, 1999/07/14
- Re: bad random numbers, John W. Eaton, 1999/07/14
- Re: bad random numbers, Thomas Walter, 1999/07/14
- Re: bad random numbers, Eric Ortega, 1999/07/15
Re: bad random numbers,
Jim Van Zandt <=
Re: bad random numbers, John Smith, 1999/07/14
Re: bad random numbers, heberf, 1999/07/13