1import random
2
3# generates completely random number
4x = random.random()
5
6# generates a random int
7x = random.randint()
8
9# generates a random int in a range
10x = random.randint(1, 100)
11
12# NOTE: RANGE DOESN'T WORK FOR random.random()
1# imports random
2import random
3# randint generates a random integar between the first parameter and the second
4print(random.randint(1, 100))
1#import random
2import random
3
4names = ['Harry', 'John', 'Smith', 'Larry']
5
6#print random name from names
7print(random.choice(names))
8
9#print random integer in a range of numbers
10print(random.randint(1, 100)
1# To create a list of random float numbers:
2import numpy
3random_float_array = numpy.random.uniform(75.5, 125.5, 2)
4# Output:
5# [107.50697835, 123.84889979]