Pseudorandom Numbers

In [1]:
import random

randrange

In [6]:
random.randrange(1, 6)
Out[6]:
4
In [20]:
for i in range(10):
    print(random.randrange(1, 50, 5))
26
26
26
16
46
31
21
1
21
11

random

In [28]:
random.random()
Out[28]:
0.9215476908492356
In [29]:
for i in range(10):
    print(random.random())
0.03150691480747625
0.2949290663487807
0.6522589129070094
0.4830475750136288
0.05084944158124238
0.1906124065579411
0.3415996682302157
0.318287455757284
0.8263076650437017
0.8162745646578653
In [30]:
help(random.random)
Help on built-in function random:

random(...) method of random.Random instance
    random() -> x in the interval [0, 1).

In [ ]: