Just how random is
JavaScript's Math.random()?




Show explanation ↓

1. Generate a random number between 0 and 1 using Math.random().

2. Round the number to the nearest integer (either 0 or 1) using Math.round().

3. Do this 1000 times every second.

4. If the rounded number equals 0, add one to the variable zero and one to the variable all. If the rounded number equals 1, add one to the variable one and one to the variable all.

5. Divide zero by all, multiply it by 100, and output as a percentage. Do the same for the one variable.