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


reply via email to

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