stnmf.util.create_rng
- stnmf.util.create_rng(seed=None)
Obtain a new seeded instance of a pseudorandom number generator compatible across Python, MATLAB, and R
Mersenne Twister (MT19937) [1].
- Parameters:
seed (
int, optional) – Initial seed. If None, the RNG will be initialized without a seed based on OS context. Default is None- Returns:
rng (
numpy.random.Generator) – The seeded random number generator
Notes
For exact compatibility with MATLAB, sequences should be sampled in column-order, e.g. two-dimensional arrays should be transposed after sampling.
Warning
Only basic sampling methods like random yield identical sequences of values as in MATLAB. More complex functions like choice are not compatible with the twister RNG of MATLAB!
References