laceside
Version:
In-browser JavaScript IDE and execution environment
16 lines (11 loc) • 318 B
JavaScript
var getRandomValue;
var crypto = window.crypto || window.msCrypto;
if (crypto) {
var lim = Math.pow(2, 32) - 1;
getRandomValue = function () {
return Math.abs(crypto.getRandomValues(new Uint32Array(1))[0] / lim);
};
} else {
getRandomValue = Math.random;
}
module.exports = getRandomValue;