jsonmaur / node-crypto-extra

Convenience methods for node crypto
MIT License
14 stars 1 forks source link

Biased randomNumber function #3

Open olalonde opened 5 years ago

olalonde commented 5 years ago

Just a heads up: your randomNumber function is biased (so probably not suitable for cryptographic purpose). See http://www.pcg-random.org/posts/bounded-rands.html for details (specifically "FP Multiply (Biased)" section).

I opened a Node.js feature request to get this into the standard library since it's such a common error: https://github.com/nodejs/node/issues/29707

jsonmaur commented 4 years ago

Thanks for the heads up. Any idea how we could fix it in the meantime?