Home >>Python Random Module

Python Random Module

Python Random Module

Python Random Module Functions depend on a pseudo-random number generator function random(), it is used to generates a random float number.

Method Description
seed() It is used to initialize the random number generator.
getstate() This method is used Returns the current internal state of the random number generator.
setstate() This method is used to Restores the internal state of the random number generator.
getrandbits() It is used to Returns a number representing the random bits.
randrange() This method Returns a random number between the given range.
randint() Between the given range it returns a random number.
choice() It helps to returns a random element from the given sequence.
choices() This method is used to returns a list with a random selection from the given sequence.
shuffle() It returns the sequence in a random order.
sample() It Returns a given sample of a sequence.
random() This method Returns a random float number between 0 and 1.
uniform() It is used to Returns a random float number between two given parameters.
triangular() This method returns a random float number between two given parameters.
betavariate() This method Returns a random float number between 0 and 1 based on the Beta distribution.
expovariate() It is used to returns a random float number between 0 and 1, or between 0 and -1.
gammavariate() This method is used to returns a random float number between 0 and 1 based on the Gamma distribution.
gauss() This method Returns a random float number between 0 and 1 based on the Gaussian distribution.
lognormvariate() This is a method which returns a random float number between 0 and 1 based on a log-normal distribution.
normalvariate() It is used to returns a random float number between 0 and 1 based on the normal distribution.
vonmisesvariate() This method returns a random float number between 0 and 1 based on the von Mises distribution.
paretovariate() It is method which returns a random float number between 0 and 1 based on the Pareto distribution.
weibullvariate() It is used to returns a random float number between 0 and 1 based on the Weibull distribution.

Python Random Module Index

Sr.No. Topics
1 Python Random seed() Method
2 Python Random getstate() Method
3 Python Random setstate() Method
4 Python Random getrandbits() Method
5 Python Random randrange() Method
6 Python Random randint() Method
7 Python Random choice() Method
8 Python Random choices() Method
9 Python Random shuffle() Method
10 Python Random sample() Method
11 Python Random random() Method
12 Python Random uniform() Method
13 Python Random triangular() Method

No Sidebar ads