Generating random samples from a normal distribution is a common task in various applications, including statistics and machine learning. Let’s learn how to generate random samples from a normal (Gaussian) distribution in Numpy Python library.
Random normal function
Numpy random normal function does the job.
Parameters:
How to generate random normal distribution in Python
Sample code:
import numpy as np my_array = np.random.normal(5, 3, size=(5, 4)) print(f"Random samples of normal distribution: \n {my_array}")
Random samples of normal distribution has been generated.