octave-maintainers
[Top][All Lists]
Advanced

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

Re: Initializing random number generator


From: Rik
Subject: Re: Initializing random number generator
Date: Wed, 14 Aug 2013 12:10:26 -0700

On 08/14/2013 09:25 AM, address@hidden wrote:
Message: 5
Date: Wed, 14 Aug 2013 16:31:49 +0200
From: Philipp Kutin <address@hidden>
Cc: address@hidden
Subject: Re: UBsans and rand()

----------

Now to my testing. The function testrand() takes the name of an RNG
and a vector of seeds. Then it prints out the first six values
returned from the requested RNG as a string of letters (for easy
comparison by eye). The results are that both negative, out-of-range,
and NaN/Inf seeds are accepted. Often, large and nonfinite numbers
lead to the same sequence. The function, a driver script, and the
result log are attached.

So IMO, it is sensible to reduce modulo 2^32 as I described in the
other thread, and to initilize using a fixed but arbitrary value in
the case of nonfinites.
8/14/13

Philipp,

Yes, this seems very sensible.  We might as well use the same fixed values for non-finites as Matlab.  At some point it would be pretty easy to add the rng() routine which would be a good thing for Matlab compatibility. 

Cheers,
Rik

reply via email to

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