# Faizaan Datoo Pd3
# A very simple example of using technology to automate simulations :)
# I /could/ have made it more complicated, but that would defeat the point!
import random
print "Enter a range of digits."
# Get those numbers...
minVal = input("\tYour minimum value: ")
maxVal = input("\tYour maximum value: ")
repetitions = input("\tAmount of repetitions: ")
perRepetition = input("\tAmount of random numbers per repetition: ")
ignoreRepeats = raw_input("\tIgnore repeats? (y/n): ")
print "Okay, crunching some numbers..."
tries = []
for i in range(repetitions):
print "=== Repetition #" + str(i + 1) + " ==="
history = []
for j in range(perRepetition):
# Generate random values, print them out
generated = random.randrange(minVal, maxVal)
# Check for duplicates if we have to!
if ignoreRepeats == "y":
while (generated in history):
generated = random.randrange(minVal, maxVal)
history.append(generated)
print str(generated) + " ",
print "Done. Enjoy!"