#!/usr/bin/python3 # -*- coding: utf-8 -*- # using someone else's code: import random # Built-in functions generate random numbers. # Each call specifies a range and returns a new random number within that range. print(random.randint(0, 5)) print(random.randint(0, 5)) print(random.randint(0, 5)) print() # To enable reproducible programs, # a programmer can set a seed, # as in random.seed(7), # prior to any calls to random.randint(). # Then, for any run of the program, # the sequence of "random" numbers is always the same for that seed. # If no seed is provided, Python3 uses the what as the seed, # yielding the expected “randomness” for each run of the program? random.seed(7) print(random.randint(0, 5)) print(random.randint(0, 5)) print(random.randint(0, 5)) print() random.seed(7) print(random.randint(0, 5)) print(random.randint(0, 5)) print(random.randint(0, 5)) # Setting seed first is optional. # Seed typically only set once, at start of program (if at all)