NOTE: Beginning in release R2008b, MATLAB includes support for random number streams. The code here is not as flexible, and uses some deprecated constructs, and is not recommended or needed for versions of MATLAB newer than R2008a.
These files provide (pseudo)Random Number Generators (RNGs) that are separate from any other calls to other MATLAB RNG functions. Create as many as you need, and they act "independently". That is, calls to one do not affect the state of the others.
Chances are, you do not need to use these. They do not make random values "more random" or "more independent". But they do have uses in certain kinds of simulation modelling work.
Two versions:
* Both versions keep track of their own state vectors internally.
* The first version sets rand and randn to its internal state, calls the appropriate RNG function, and resets rand and randn, each time it's called.
* The second version maintains an internal buffer of random values, and does the above only when the buffer runs short.
The difference is that the second version trades memory overhead for time overhead, and is perhaps more appropriate for users whose simulations dictate getting random values one at a time.
By default, the RNG streams are all initialized to the same zero'th state, meaning they are perfectly correlated if they stay in sync. You'll want to avoid that by initializing to different states. |