Have you ever needed to generate a random number in code? whether it's for rolling a dice, or shuffling a set, this tweet thread is here for you! There's no reason that it should be easy or obvious, very experienced programmers repeat common mistakes. I did, before I learned ...
-
-
I'd ignore distributions (like gaussian), doubles, floats, etc, but if there's a BigNum library it should have a native secure random for the types it supports. I would have a pick() for weighted selection in its own library, using a dictionary or whatever for weights.
-
It is interesting that you think shuffle() should be in the stdlib. IMO it is a niche functionality and is better left in the satellite library.
- 6 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.