Tim Hoang wrote: . . . if x is greater (meaning its chance of living) is less than its chance of dying(myProbDeath). . . .
That's not what it means at all. It means you are choosing a "random" number between 0 and 0.9999999999999... and comparing another number to it.
has exactly a 25% chance of being executed and exactly a 75% chance of not being executed, assuming myRandom is uniformly distributed across that range. Try counting, with 0, 0.05, 0.1, 0.15 ... 0.95 (not 1.0), and see what happens. See how many of those numbers will allow execution of the
if. Note that
will have a very very slightly lower chance than 25%, because you are using the range from 0.7500000000000001... to 0.9999999999999..., not to 1.0. Try counting with 0, 0.05, 0.1 ... 0.95 again, and see what happens.