- Random Module in NumPy (
numpy.random)
- Functions for generating random numbers from Random Module
- Generating random numbers:
np.random.rand(): random float from 0 to 1
np.random.randn():
random.rand(): Random floats: yes,
randn() ?? # returns a random float between 0 and 1.
np.random.randint(range): Random integers in a range
random.randint(100, size=(5)): Random Array:
random.randint(100, size=(3, 5)): Random Array:
np.random.normal():
- Random samples/sampling:
random.random_sample()
random.choice()
random.shuffle()
np.random.seed(): Seeding for reproducibility/Setting seed
- Permutations and shuffling:
np.random.permutation():
np.random.shuffle():
- Probability distributions:
np.random.normal() – Normal distribution
np.random.uniform() – Uniform distribution
np.random.binomial() – Binomial distribution