workerd
workerd copied to clipboard
Python: Make top level random() raise
We don't have access to entropy outside of request scope, so random() will give poor results. Raise an error if it is called.
Okay I updated this to handle numpy, added more detailed comments and internal tests.
Okay, now there is a problem that rust uses randomness for hash seeds: https://github.com/rust-lang/rust/blob/master/library/std/src/sys/pal/unix/rand.rs#L235-L247 https://github.com/rust-lang/rust/blob/master/library/std/src/hash/random.rs?plain=1#L68