Get a numpy.random.RandomState instance.

The purpose of this utility function is to have a flexible way to initialise a RandomState instance, a.k.a. a random number generator (rng).

See Random numbers for usage examples and further information.

init : {int, ‘random-seed’, ‘global-rng’, RandomState}

Available options to initialise the RandomState object:

  • int – new RandomState instance seeded with this integer (calls RandomState with seed=init)
  • 'random-seed' – new RandomState instance seeded in a random way (calls RandomState with seed=None)
  • 'global-rng', return the RandomState singleton used by numpy.random.
  • RandomState – do nothing, return the input.
random_state : RandomState

RandomState instance.