[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sampling from two instances of a random number generator
From: |
Søren Hauberg |
Subject: |
Re: sampling from two instances of a random number generator |
Date: |
Sun, 25 May 2008 22:28:37 +0200 |
søn, 25 05 2008 kl. 22:18 +0200, skrev Søren Hauberg:
> function retval = myrand (sz, state)
> rand ("state", state);
> retval = rand (sz);
> endfunction
Aarrghh, posted the wrong function. It should of course only set the
state once. So, something like this should do:
function retval = myrand (sz, state),
persistent static_state = [];
if (isempty (static_state))
static_state = state;
rand ("state", state);
endif
retval = rand (sz);
endfunction
Søren
P.S. This code isn't really tested, so you should check it before using
it :-)
- 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, 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, 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