codahale/metrics — pull request #96 by jcdavis (2011-10-23 19:48:28+00:00)
Title: Slightly better random generation for reservoir sampling

`nextLong() % n` Is ever so slightly not uniform since `2^63` is generally not a multiple of `n`. Truthfully you would need 10+ million calls to even get a tiny change of seeing `nextLong()` return a number in "unfair range" (i.e. above `Long.MAX_VALUE-Long.MAX_VALUE%n`), but even if it doesn't happen the only cost is the extra function call