This isn't the first time that "can Math.random() equal" has been asked.
Will JavaScript random function ever return a 0 or 1?
Is it possible for Math.random() === Math.random()
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random - higher level explanation
https://hackernoon.com/how-does-javascripts-math-random-generate-random-numbers-ef0de6a20131 - lower level explanation
So; my question: can JavaScript's Math.random() ever exactly equal .5?
It fits the definition of >= 0 && < 1
. But in practice, I've tried a few different approaches, last one being:
while (Math.random() != .5)
They all either time out or never exactly equal .5
Billions of attempts / several browser (firefox 60+ X64) crashes later. Is it possible? Is it browser/system dependent? Is it my lack of comprehension regarding statistical probabilities?