In the past computers where using generators that under some particular tests turned out to be performing really really bad.
In the past computers where using generators that under some particular tests turned out to be performing really really bad.
var random = [];
var i = 10;
while(i) {
random.push(Math.floor(Math.random() * 2));
i--;
}console.log(random.join());
I was just manually doing the insertions. It lost five out of five times, though the last time only by a very small amount.
It seems also that it generated very often a 1 after a 0 (more than twice as many times than it generates another 0).
Now I got curious, I'll do more tests and look at the documentation for Math.random
Certainly I won't ever use it for any important feature of a website!
EDIT: it seems that with large enough numbers it's not too bad, so I might be able to say more after reading the documentation. At any rate using the strings generated with the khanacademy link I was able to win few times in a row.