I am making a lotto simulator which creates lotto numbers until it matches one on your ticket and says on which date you would have won. It works great, but it is very slow.
The way I used to do create the numbers was: sorted(random.sample(range(1,51), 6))
however recently I have used sorted(int((random.random() * 47.46927)) for _ in range(6))
.
(47.46927=(50*49*48*47*46*45)**(1/6) to compensate for that this doesn't take care of duplicates)
This is quite a bit faster, but still painfully slow.
Is there a way to speed things up a bit?
Aucun commentaire:
Enregistrer un commentaire