The random Module for Random Data Generation in Python


Generate random numbers or select random items from sequences.

Source Code

import random
print(random.randint(1, 100))  # Random integer between 1 and 100
print(random.choice(["apple", "banana", "cherry"]))  # Randomly select an item
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments