Skip to content

Generate random int between a given range in Python

Advertisements
import random


# Generate a random int between a given range (min,max).
def random_int_between_min_max(min, max):
    return random.randint(min, max)


def main():
    # Generate a random int between 0 and 100.
    print(random_int_between_min_max(0, 100))


main()

See also  Python code snippet - How to access a variable from another py file in vs?

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.