sampling from two instances of a random number generator
Ben Abbott
bpabbott at mac.com
Sat May 24 19:35:40 CDT 2008
On May 24, 2008, at 5:39 PM, Leo Razoumov wrote:
> Hi ALL,
> I need to sample from several instances of a random number generator
> in the same program. Apparently, Octave does not let me do it. It
> seems as though that "rand" has only one global state. The best advice
> from the manual is to save/restore rand state with
> v = rand("state")
> rand("state", v)
>
> Since I have to draw only one number at a time from each RNG millions
> of time this can quickly become a nuisance. Also, it is plain ugly!
> Octave is object oriented, right? Why not to have a RNG constructor
> rng1= RNGuniform(seed)
> ...
> sample= rng1.get()
>
> or something similar. Is it a Matlab heritage or I am missing
> something important?
>
> Thanks,
> --Leo--
In March there was a discussion on random number generation and Matlab
compatibility. You can read through it at the link below.
http://www.nabble.com/Difference-between-Matlab-and-Octave-in-random-seeding-tt15508096.html#a15912898
Perhaps the answers to your questions are there.
Ben
More information about the Help-octave
mailing list