Echo JS 0.11.0

<~>

tracker1 3156 days ago. link 2 points
You should use/wrap the web crypto api[0] where available[1].

    var crypto = window.crypto || window.msCrypto; // for IE 11
    var array = new Uint32Array(10);
    crypto.getRandomValues(array);

Uint32Array should now be filled with cryptographically sound random numbers.  There are JS based algorithms that generate better random numbers than Math.Random, but polyfills are a bit heavy.

If you're using webpack/browserify, the crypto library's random is polyfilled, which you can use safely.

    [0] https://developer.mozilla.org/en-US/docs/Web/API/Window/crypto
    [1] http://caniuse.com/#feat=cryptography