Normal Distribution in NumPy Last Updated : 23 Apr, 2025 Comments Improve Suggest changes Like Article Like Report The Normal Distribution also known as the Gaussian Distribution is one of the most important distributions in statistics and data science. It is widely used to model real-world phenomena such as IQ scores, heart rates, test results and many other naturally occurring events.numpy.random.normal() MethodIn Python's NumPy library we can generate random numbers following a Normal Distribution using the numpy.random.normal() method. It has three key parameters:loc : Specifies the center (mean) of the distribution, where the peak of the bell curve exists.scale : Determines the spread (standard deviation) of the distribution controlling how flat or narrow the graph is.size : Defines the shape of the returned array.Syntax :numpy.random.normal(loc=0.0, scale=1.0, size=None)Example 1: Generate a Single Random NumberTo generate a single random number from a default Normal Distribution (loc=0, scale=1): Python import numpy as np random_number = np.random.normal() print(random_number) Output:0.013289272641035141Example 2: Generate an Array of Random NumbersTo generate multiple random numbers Python random_numbers = np.random.normal(size=5) print(random_numbers) Output:[ 1.44819595 0.90517495 -0.75923069 0.50357022 -0.34776612]Visualizing the Normal DistributionVisualizing the generated numbers helps in understanding their behavior. Below is an example of plotting a histogram of random numbers generated using numpy.random.normal. Python import numpy as np import matplotlib.pyplot as plt data = np.random.normal(loc=0, scale=1, size=1000) plt.hist(data, bins=30, edgecolor='black', density=True) pdf = norm.pdf(x, loc=loc, scale=scale) plt.plot(x, pdf, color='red', label='Theoretical PDF') plt.title("Normal Distribution") plt.xlabel("Value") plt.ylabel("Density") plt.grid(True) plt.show() Output: Normal DistributionThe histogram represents the frequency of the generated numbers and the curve shows the theoretical pattern for comparison. The curve of a Normal Distribution is also known as the Bell Curve because of the bell-shaped curve. Comment More infoAdvertise with us Next Article Normal Distribution in NumPy A ayushimalm50 Follow Improve Article Tags : Python Numpy python Practice Tags : pythonpython Similar Reads Python - Normal Distribution in Statistics A probability distribution determines the probability of all the outcomes a random variable takes. The distribution can either be continuous or discrete distribution depending upon the values that a random variable takes. There are several types of probability distribution like Normal distribution, 6 min read Normal Distribution Plot using Numpy and Matplotlib In this article, we will see how we can create a normal distribution plot in python with numpy and matplotlib module. What is Normal Distribution?Normal Distribution is a probability function used in statistics that tells about how the data values are distributed. It is the most important probabilit 2 min read Python - Power Normal Distribution in Statistics scipy.stats.powernorm() is a power normal continuous random variable. It is inherited from the of generic methods as an instance of the rv_continuous class. It completes the methods with details specific for this particular distribution. Parameters : q : lower and upper tail probability x : quantile 2 min read How to Create a Normal Distribution in Python PyTorch In this article, we will discuss how to create Normal Distribution in Pytorch in Python. torch.normal() torch.normal() method is used to create a tensor of random numbers. It will take two input parameters. the first parameter is the mean value and the second parameter is the standard deviation (std 2 min read NumPy Introduction NumPy(Numerical Python) is a fundamental library for Python numerical computing. It provides efficient multi-dimensional array objects and various mathematical functions for handling large datasets making it a critical tool for professionals in fields that require heavy computation.Table of ContentK 7 min read Like