Python Practice › NumPy Programs › Program 22
Five standard normal numbers
Write a NumPy program to generate 5 random numbers from a standard normal distribution.
Output
[ 0.001 0.299 -0.274 -0.891 -0.455]
Approach
rng.standard_normal(5).
Solution
import numpy as nprng = np.random.default_rng(7)print(rng.standard_normal(5).round(3))Output
[ 0.001 0.299 -0.274 -0.891 -0.455]
Learn the concept
New to this topic? Read the lesson, then come back.