help-octave
[Top][All Lists]
Advanced

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

Re: sampling from two instances of a random number generator


From: Ben Abbott
Subject: Re: sampling from two instances of a random number generator
Date: Sat, 24 May 2008 20:35:40 -0400


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




reply via email to

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