Tag: 生日悖论

随机几乎是随机的?

我做了这个来testingrandint的随机性: >>> from random import randint >>> >>> uniques = [] >>> for i in range(4500): # You can see I was optimistic. … x = randint(500, 5000) … if x in uniques: … raise Exception('We duped %d at iteration number %d' % (x, i)) … uniques.append(x) … Traceback (most recent call last): File "<stdin>", […]