Random Module

The Python random module functions depend on a pseudo-random number generator function random(), which generates the float number between 0.0 and 1.0.

There are different types of functions used in a random module which is as follows:

random.random()

This function generates a random float number between 0.0 and 1.0.

random.randint()

This function returns a random integer between the specified integers.

random.randrange()

This function returns a randomly selected element from the range created by the start, stop, and step arguments. Value of start is 0 by default.

random.choice()

This function returns a randomly selected element from a non-empty sequence.

random.shuffle()

This function randomly reorders the elements in the list.

Related Tutorial
Follow Us
https://www.facebook.com/Rookie-Nerd-638990322793530 https://twitter.com/RookieNerdTutor https://plus.google.com/b/117136517396468545840 #
Contents