News for hackers. Stuff that matters.
Re:Algorithms Every Data Scientist Should Know: Reservoir Sa... by brendano on Tuesday July 02, 2013 @12:04AM (#5975757)
Once you've reached input number 10^8 or whatever, you've got all sorts of chances to have arithmetic overflow and/or the weirdness of that many pseudo-random operations screw you.

Why? Double floats don't overflow until 10^-300 or so, and RNG's give uniform numbers from 0 to 1 just fine...

Re:Algorithms Every Data Scientist Should Know: Reservoir Sa... by dbaupp on Tuesday July 02, 2013 @07:35AM (#5977077)
Most RNGs that generate numbers from 0 to 1 actually just generate a random 64-bit value, and divide by 2^64; which means that they do underflow relatively easily. (This is relatively easily to overcome using a better (& more expensive) random bits -> double algorithm.)