w3resource logo
Python Exercises

Python: Generate five random numbers from the normal distribution

Python NumPy: Random Exercise-1 with Solution

Write a Python program to generate five random numbers from the normal distribution.

Sample Solution:-

Python Code:

import numpy as np
x = np.random.normal(size=5)
print(x)

Sample Output:

[-1.85145616 -0.4639516   0.49787567  1.23607083 -1.33332987]

Python Code Editor:

import numpy as np
x = np.random.normal(size=5)
print(x)

Improve this sample solution and post your code through Disqus