DEV Community

loading...

Discussion on: Rando.js: replacing Math.random()

Collapse
po5i profile image
Carlos Villavicencio

Looks promising! Is this library a pseudorandom one like Math.random or is it a true random algorithm?

Collapse
aryanbeezadhur profile image
Aryan Beezadhur

It is pseudorandom, look at the GitHub repo

Collapse
nastyox1 profile image
nastyox Author

It's been getting some attention, so I upgraded it to a cryptographically secure random now. Thanks for being interested in it from the start.

Collapse
mrspartak profile image
Spartak

It is using Math.random, just added sugar around it.
Made a ton prototypes long time ago for such tasks

Array.prototype.getRandom = function () {
    return this[Math.floor(Math.random() * this.length)];
};
console.log( [1, 2, 3].getRandom() )