jeudi 18 août 2016

better random in python

In an application I use

random.randint(1, 20)

this application is hosted on heroku, and runs on a single dyno. I have encountered the following output when this code fragment gets called 3 to 2 times a second:

9
9
19
9

this is not a coincidence, since I have asked a few people to test it, and they were able to confirm it. Now the question is:

Is there a better way to generate random integers in python?




Aucun commentaire:

Enregistrer un commentaire