In Numpy we are provided with the module called random module that allows us to work with random numbers. The random module provides different methods for data distribution. In this article, we have to create an array of specified shape and fill it random numbers or values such that these values are part of a normal distribution or Gaussian distribution. This distribution is also called the Bell Curve this is because of its characteristics shape.
To generate five random numbers from the normal distribution we will use numpy.random.normal() method of the random module.
Syntax: numpy.random.normal(loc = 0.0, scale = 1.0, size = None)
loc: Mean of distribution
scale: Standard derivation
size: Resultant shape.
If size argument is empty then by default single value is returned.
[ 0.27491897 -0.18001994 -0.01783066 1.07701319 -0.11356911]
1D Array with random values : [ 0.14559212 1.97263406 1.11170937 -0.88192442 0.8249291 ]
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- Generate Random Numbers From The Uniform Distribution using NumPy
- Normal Distribution Plot using Numpy and Matplotlib
- rand vs normal in Numpy.random in Python
- Python - Log Normal Distribution in Statistics
- Python - Power Log-Normal Distribution in Statistics
- Python - Normal Inverse Gaussian Distribution in Statistics
- Python - Normal Distribution in Statistics
- Python - Skew-Normal Distribution in Statistics
- Python - Power Normal Distribution in Statistics
- Python - Truncated Normal Distribution in Statistics
- Random sampling in numpy | random() function
- Source distribution and built distribution in python
- Secrets | Python module to Generate secure random numbers
- Python | Generate random numbers within a given range and store in a list
- random.random() function in Python
- Python | Generate random string of given length
- Python - Generate random number except K in list
- Python | Generate random number except K in list
- Python Program to Generate Random binary string
- How to generate 2-D Gaussian array using NumPy?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.