Random Module
- provides access to functions that support many operations. Perhaps the most important thing is that it allows you to generate random numbers.
Use it to get a random integer
import random
print random.randint(0, 5)
For when you want a large number use multiply
import random
random.random() * 100
Generate random value form the sequence
random.choice( ['red', 'black', 'green'] )
Shuffles elements
from random import shuffle
x = [[i] for i in range(10)]
shuffle(x)
Generate a random element from a range
import random
for i in range(3):
print random.randrange(0, 101, 5)
The probability of any unwanted incident is defined as Risk