The random module can be used to make random numbers in Python. The function random() generates a number between 0 and 1.
Generate a real number between 0 and 1
Simply call the random() method to generate a real (float) number between 0 and 1.
Generate a number between 0 and 50
We use the randint() method to generate a whole number.
Generate a random number between 1 and 10
Change the parameters of randint() to generate a number between 1 and 10.
To generate a list of 100 random numbers:
To get 3 random items from a list: