The following are functions in the random module, see the page on modules for directions on how to import thrm into your program.
- random.random() returns a random floating point number between 0.0 and 1.0.
- random.randint(a,b) returns a random integer between a and b, inclusive.
- random.uniform(a,b) returns a random floating point number between a and b.
- random.choice(s) returns a random element of sequence s. For example, random.choice([1,3,7]) will return either 1, 3, or 7.
- random.shuffle(s) shuffles sequence s in place. Hence, the original s is changed and nothing is returned. If you want to preserve the original order also you need to copy the list first (myListCopy = myList[:] would work).