4 ms·
The problem is not random() itself, it's constructs like random() % n. Even if you replace random() with a CSPRNG, misuse won't go away.
by sobriquet9 6y ago
The problem is not random() itself, it's constructs like random() % n. Even if you replace random() with a CSPRNG, misuse won't go away.
- ddtaylor 6y agoI don't agree. I think Python and a few others do a good job by making random range based functions like `randrange` at curbing misuse.
- sobriquet9 6y agoFor cases where small statistical differences matter, like Monte-Carlo simulation, the overhead is non-trivial. Linear congruential generator is so simple it can be inlined by the compiler.