How do you generate a random integer i such that 0<= i < 20?
The random module is requried to import in the program. This module contains predefined functions to find the random numbers from the specific range.
The randint() function is used to rgenerate the random number from range 0, 19.
Code:
import random
# random integer from 0 to 19
rand_num = random.randint(0, 19)
print(rand_num)
Output:
> 9