Math.random() does not provide cryptographically secure random numbers. Do not use them for anything related to security. Use the Web Crypto API instead, and more precisely the window.crypto.getRandomValues() method
Please, please, if you're going to go into anything related to security, read up on the subject. It's ok to do things like to learn, but putting them into production is unwise. See, for example, https://www.schneier.com/crypto-gram/archives/1998/1015.html... and read up, with books like Applied Cryptography. Read a few DefCon papers or videos.
8 comments
[ 3.5 ms ] story [ 33.4 ms ] threadMath.random() does not provide cryptographically secure random numbers. Do not use them for anything related to security. Use the Web Crypto API instead, and more precisely the window.crypto.getRandomValues() method