4 ms·
What benefits does this method offer? The key thing that makes it better than what Mike was doing is to use /dev/urandom instead of Math.random, which isn't alw
by seba_dos1 11y ago
What benefits does this method offer? The key thing that makes it better than what Mike was doing is to use /dev/urandom instead of Math.random, which isn't always possible (for instance, in the browser). With V8's Math.random, it's going to fail the same way.
- geofft 11y agoIn the browser you have window.crypto.getRandomValues(), which is a CSPRNG just like /dev/urandom and available in every current browser other than Opera Mini: http://caniuse.com/#feat=getrandomvalues http://caniuse.com/#feat=getrandomvalues (But, in either the browser or in native code, you should use your platform's CSPRNG directly instead of writing an ad-hoc CSPRNG on top of it.)