>>> import random >>> random.SystemRandom.randint(0, 10) Traceback (most recent call last): File "<pyshell#3>", line 1, in <module> random.SystemRandom.randint(0, 10) TypeError: randint() missing 1 required positional argument: 'b'
SystemRandom should give random numbers, although os.urandom , randint works like a normal randrange :
>>> print(random.SystemRandom.randint.__doc__) Return random integer in range [a, b], including both end points.
A small pop-up sentence appears in IDLE when I type it saying
`random.SystemRandom.randint(self, a, b)`
I think that is the reason. I don't use classes very well and understand how they work, but the first argument seems to be passed as self when it should be a . I never understand why self used when it is not even a keyword, and how it should work, but it usually does.
Am I doing this wrong, or should I report it to the Python Foundation when someone should do such things?
python random
Henrik oldcorn
source share