Testing questions that use random in Python3

Re: Testing questions that use random in Python3

by Ian Currie -
Number of replies: 0

Here is a simplified test case that should work for your particular question (assuming that the students writes a sub-function called randomNumberGenerator)

expectedResults = []
studentResults = []
random.seed(0)
for i in range(0,100):
    expectedResults.append(random.randint(1,100))
random.seed(0)
for i in range(0,100):
    studentResults.append(randomNumberGenerator())
print(expectedResults == studentResults)