So I have this simple test in nodejs, I left it running overnight and could not get Math.random() to repeat. I realize that sooner or later the values (or even the whole sequence) will repeat, but is any reasonable expectancy as to when it is going to happen?
let v = {};
for (let i = 0; ; i++)
{
let r = Math.random();
if (r in v) break;
v[r] = r;
}
console.log(i);
Aucun commentaire:
Enregistrer un commentaire