[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bad random numbers

From: Mike Miller
Subject: Re: bad random numbers
Date: Tue, 13 Jul 1999 20:28:14 -0500 (CDT)

Not everyone is getting it.  Look at these two lines:

echo 'rand(3)' | octave -q
echo 'rand("seed",time);rand(3)' | octave -q

Question:  If rand gets its seed from the clock when octave starts, then
why does the first command line above give aberrant results while the
second command works beautifully?

Answer: There is an error in the generation of the initial seed.

Am I wrong?

I don't know C and can't fix it, but it should be easy for a C programmer
to compare and randinit.m and figure out what's wrong in

MATLAB doesn't promise to generate a seed from the system clock at
startup.  It would be nice if they did generate the seed, but they don't
do it, so I can't criticize their method of seed generation.


Michael B. Miller
University of Missouri--Columbia

Octave is freely available under the terms of the GNU GPL.  To ensure
that development continues, see
Instructions for unsubscribing:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]