get_random_state#
- gammapy.utils.random.get_random_state(init)[source]#
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 How to use random numbers for usage examples and further information.
- Parameters
- init{int, ‘random-seed’, ‘global-rng’,
RandomState
} Available options to initialise the RandomState object:
int
– new RandomState instance seeded with this integer (callsRandomState
withseed=init
)'random-seed'
– new RandomState instance seeded in a random way (callsRandomState
withseed=None
)'global-rng'
, return the RandomState singleton used bynumpy.random
.RandomState
– do nothing, return the input.
- init{int, ‘random-seed’, ‘global-rng’,
- Returns
- random_state
RandomState
RandomState instance.
- random_state