The random module in Python provides various built-in methods and functions to generate random numbers. Before using the random module, you need to import it using the following line of code:
```
import random
```
Here are examples of some common ways to use the random module:
1. Generate a random number between 0 and 1
```
random_number = random.random()
print(random_number) # Output: a random float number between 0 to 1
```
1. Generate a random number within a range
```
random_number = random.randint(1, 10)
print(random_number) # Output: a random integer number between 1 to 10
```
1. Generate a random floating point number within a range
```
random_number = random.uniform(1, 10)
print(random_number) # Output: a random float number between 1 to 10
```
1. Choose a random element from a list
```
my_list = [1, 2, 3, 4, 5]
random_element = random.choice(my_list)
print(random_element) # Output: a random element from the list
```
1. Shuffle elements of a list randomly
```
my_list = [1, 2, 3, 4, 5]
random.shuffle(my_list)
print(my_list) # Output: shuffled list
```
1. Generate a random sample from a list
```
my_list = [1, 2, 3, 4, 5]
random_sample = random.sample(my_list, 3)
print(random_sample) # Output: a list of 3 random elements from the list
```