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  TypeScript code snippet - How to take multiple inputs in one propmt?

Leave a Reply

Your email address will not be published. Required fields are marked *

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