Random module- Function in this module depend upon the pseudo random number generator function random.
random()- Generates a random float number 0.0 to 1.0.
e.g.,
import random random.random()
![](https://pythonpoint.net/wp-content/uploads/2021/01/Screenshot-1331-1024x148.png)
randint()- Returns a random integer between the specified integers.
syntax:-
import random random.randint(1,100)
![](https://pythonpoint.net/wp-content/uploads/2020/12/Screenshot-1144-1024x146.png)
randrange()- Returns a randomly selected element from the range.
e.g.,
import random random.randrange(1, 10, 2)
![](https://pythonpoint.net/wp-content/uploads/2020/12/Screenshot-1143-1024x154.png)
choice()- Returns a randomly selected element from non-empty sequence.
e.g.,
import random random.choice("pythonpoint")
![](https://pythonpoint.net/wp-content/uploads/2020/12/Screenshot-1146-1024x149.png)
shuffle()- Randomly reorders elements in a list.
syntax:-
import random a=[1, 2, 3, 4, 5, 6, 7, 8] random.shuffle(a) print(a)
![](https://pythonpoint.net/wp-content/uploads/2021/01/Screenshot-1333-1024x167.png)
This is all about random module in python.