You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using mod to fit random numbers to a range means that the words in the list that could be hit by the mod are twice as likely to be chosen as those that aren’t. 💥
I think the canonical way to handle this is, instead, to keep generating random numbers until you get one that's in range.
Using mod to fit random numbers to a range means that the words in the list that could be hit by the mod are twice as likely to be chosen as those that aren’t. 💥
I think the canonical way to handle this is, instead, to keep generating random numbers until you get one that's in range.
Here’s a good example from Python: http://hg.python.org/cpython/file/default/Lib/random.py#l216
The text was updated successfully, but these errors were encountered: