Normal Distribution in NumPy Last Updated : 23 Apr, 2025 Summarize Comments Improve Suggest changes Share 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 : Numpy python Practice Tags : python Similar Reads Python Tutorial - Learn Python Programming Language Python is one of the most popular programming languages. Itâs simple to use, packed with features and supported by a wide range of libraries and frameworks. Its clean syntax makes it beginner-friendly. It'sA high-level language, used in web development, data science, automation, AI and more.Known fo 10 min read Support Vector Machine (SVM) Algorithm Support Vector Machine (SVM) is a supervised machine learning algorithm used for classification and regression tasks. It tries to find the best boundary known as hyperplane that separates different classes in the data. It is useful when you want to do binary classification like spam vs. not spam or 9 min read Logistic Regression in Machine Learning Logistic Regression is a supervised machine learning algorithm used for classification problems. Unlike linear regression which predicts continuous values it predicts the probability that an input belongs to a specific class. It is used for binary classification where the output can be one of two po 11 min read File Handling in Python File handling refers to the process of performing operations on a file such as creating, opening, reading, writing and closing it, through a programming interface. It involves managing the data flow between the program and the file system on the storage device, ensuring that data is handled safely a 7 min read Python Lambda Functions Python Lambda Functions are anonymous functions means that the function is without a name. As we already know the def keyword is used to define a normal function in Python. Similarly, the lambda keyword is used to define an anonymous function in Python. In the example, we defined a lambda function(u 6 min read Python Quiz These Python quiz questions are designed to help you become more familiar with Python and test your knowledge across various topics. From Python basics to advanced concepts, these topic-specific quizzes offer a comprehensive way to practice and assess your understanding of Python concepts. These Pyt 3 min read Python Keywords Keywords in Python are reserved words that have special meanings and serve specific purposes in the language syntax. Python keywords cannot be used as the names of variables, functions, and classes or any other identifier. Getting List of all Python keywordsWe can also get all the keyword names usin 2 min read Printing Pyramid Patterns in Python Pyramid patterns are sequences of characters or numbers arranged in a way that resembles a pyramid, with each level having one more element than the level above. These patterns are often used for aesthetic purposes and in educational contexts to enhance programming skills.Exploring and creating pyra 9 min read Generative Adversarial Network (GAN) Generative Adversarial Networks (GANs) help machines to create new, realistic data by learning from existing examples. It is introduced by Ian Goodfellow and his team in 2014 and they have transformed how computers generate images, videos, music and more. Unlike traditional models that only recogniz 12 min read Natural Language Processing (NLP) Tutorial Natural Language Processing (NLP) is a branch of Artificial Intelligence (AI) that helps machines to understand and process human languages either in text or audio form. It is used across a variety of applications from speech recognition to language translation and text summarization.Natural Languag 5 min read Like