First page Back Continue Last page Overview Graphics

random-submodule

random is a submodule of numpy for random number generation.

The method seed() is called when 'RandomState' is initialized. It can be called again to re-seed the generator.

It can be used to set an initial value:

np.random.seed(4387977)

A program using such a seed value will always produce the same sequence of „random numbers“.

If seed() is not called, NumPy will automatically create a random value depending on the time.

Creating random numbers in the interval [0.0, 1.0[ :

>>> np.random.rand(3)

array([ 0.87450015, 0.349338 , 0.09100537])

>>>