get_random_state¶
-
gammapy.utils.random.get_random_state(init)[source]¶ Get a
numpy.random.RandomStateinstance.The purpose of this utility function is to have a flexible way to initialise a
RandomStateinstance, a.k.a. a random number generator (rng).See Caplog fixture 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 (callsRandomStatewithseed=init)'random-seed'– new RandomState instance seeded in a random way (callsRandomStatewithseed=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