[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sampling from two instances of a random number generator
From: |
Jaroslav Hajek |
Subject: |
Re: sampling from two instances of a random number generator |
Date: |
Sun, 25 May 2008 07:59:47 +0200 |
On Sat, May 24, 2008 at 11:39 PM, Leo Razoumov <address@hidden> 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?
>
Yes, primarily it is a Matlab heritage. (Octave is FIRST open source,
THEN Matlab compatible, THEN object oriented :). Also, I think that
the underlying code in libcruft uses global states as well, so it
would have to be modified or replaced.
Why do you need a million of independent RNGs? Perhaps there is some
other way to solve the problem.
> Thanks,
> --Leo--
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www.cae.wisc.edu/mailman/listinfo/help-octave
>
--
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz
- sampling from two instances of a random number generator, Leo Razoumov, 2008/05/24
- Re: sampling from two instances of a random number generator, Ben Abbott, 2008/05/24
- Re: sampling from two instances of a random number generator,
Jaroslav Hajek <=
- Re: sampling from two instances of a random number generator, Leo Razoumov, 2008/05/25
- Re: sampling from two instances of a random number generator, Leo Razoumov, 2008/05/25
- Re: sampling from two instances of a random number generator, Søren Hauberg, 2008/05/26
- Re: sampling from two instances of a random number generator, Leo Razoumov, 2008/05/27
- Re: sampling from two instances of a random number generator, David Bateman, 2008/05/27
Re: sampling from two instances of a random number generator, Francesco Potorti`, 2008/05/25