mvpa2.misc.support.get_rng

mvpa2.misc.support.get_rng(r=None)

Return instantiated numpy.random.RandomState given r.

If r is None, return numpy.random singleton, so it will not be reinitialized for each invocation of get_random_state.

If r is int, it is used to seed a new numpy.random.RandomState, so you would be guaranteed to get reproducible random operations upon each invocation of the function using get_random_state

If r is an existing numpy.random.RandomState instance, it simply will be returned and thus reused, possibly across multiple calls to the object using this get_random_state.