help-octave
[Top][All Lists]
Advanced

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

sampling from two instances of a random number generator


From: Leo Razoumov
Subject: sampling from two instances of a random number generator
Date: Sat, 24 May 2008 17:39:56 -0400

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--


reply via email to

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