|
Math.random should return a number that is greater than or equal to 0, and less than 1. So your lower bound at least, will eventually turn up.
The problem is the 'eventually' part. Doubles are 64 bit types, so there's 2^64 representable values between 1 and 0; that's 1.8e19 in standard form. With this many choices, it'll be a while before you end up with exactly zero, especially considering that there are only 2.4e9 seconds in the average western human lifespan.
It's perfectly possible to include both ends, but statistically you won't see them unless you limit the number of values that Math.random can return. Perhaps you only need integers, or perhaps you only need numbers that go down to two decimal places.
|