generate an array of 5 random numbers from a standard normal distribution using NumPy.

In this python numpy program, we will generate an array of 5 random numbers from a standard normal distribution using NumPy.

Steps to solve the program
  1. Import the numpy library as np.
  2. Generate an array of 5 random numbers from a standard normal distribution using np.random.normal(size=5).
  3. Print the output.
				
					import numpy as np
x = np.random.normal(size=5)
print(x)
				
			

Output :

				
					[ 0.07450327 -1.26415493  0.61604056  0.61595139 -1.07081685]
				
			

generate random numbers between 1-2.

create a vector with values ranging from 1 to 20.

Leave a Comment