Random Numbers in NumPy

Machine Learning courses with 100+ Real-time projects Start Now!!

Program 1

from numpy import random

#Random number
#randint() , rand()
# How to generate Random Array
# How to generate  Random number from  array using choice()

# myar=random.choice([10,4,6,1,5,8,7,12,56],size=(5))
# print(myar)
# x=random.choice([10,4,6,1,5,8,7,12,56])
# print(x)
# myar=random.randint(100,size=(2,3,3))
# print(myar.shape)
# print(myar)
# myar=random.randint(100,size=(3,5))
# print(myar)
# # print(type(myar))
# # print(myar.shape)

#randint() , rand() ,choice()
# m=random.rand(5)
# print(m)
# t=random.randint(2)
# if(t==0):
#     print("Head")
# else:
#      print("Tail")
        













# x=random.choice([10,4,6,1,5,8,7,12,10],size=(2,2))
# print(x)
# myar2=random.randint(1000,size=(2,3,4))
# print(myar2)

# x=random.randint(100)
# print(x)
# x=random.rand(5)
# print(x)

# toss=random.randint(2)
# if(toss==0):
#     print("first Player won")
# else:
#       print("second player won")  

# myar1=random.randint(100,size=5)
# print(myar1)

 

You give me 15 seconds I promise you best tutorials
Please share your happy experience on Google

courses
Image

DataFlair Team

DataFlair Team provides high-impact content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. We make complex concepts easy to grasp, helping learners of all levels succeed in their tech careers.

Leave a Reply

Your email address will not be published. Required fields are marked *