Many languages, e.g. JavaScript, use the same type of random() which generates between [0,1) and suggest the following randrange() implementation:
import random
def custom_randrange(max):
return int(random.random() * max)
A student may be able to make a program that correctly follows the specification using this implementation and still fails check50.
This will fail check50 despite producing numbers in the correct range per the specification. The problem set could make this explicit by checking if the student uses random.randrange() or random.randint() and checking for different results depending on the implementation.
Alternatively, make the required methods explicitly required in some way.
Many languages, e.g. JavaScript, use the same type of
random()
which generates between[0,1)
and suggest the followingrandrange()
implementation:A student may be able to make a program that correctly follows the specification using this implementation and still fails check50.
This will fail check50 despite producing numbers in the correct range per the specification. The problem set could make this explicit by checking if the student uses
random.randrange()
orrandom.randint()
and checking for different results depending on the implementation.Alternatively, make the required methods explicitly required in some way.