Newcomb
Generate random numbers that adhere to Benford's Law
Usage
Newcomb works very much like Kernel.rand
or SecureRandom.random_number
. In
order to fetch a random float between 0 (inclusive) and 1 (exclusive):
Newcomb.random_number # => 0.49552091973604767
To fetch a random positive integer, provide the upper (exclusive) limit:
Newcomb.random_number(100) # => 16
Over a sufficiently large sample size, the distribution of Newcomb's random numbers will demonstrate Benford's Law.
History
While Benford's Law is named after American scientist Frank Benford, the principle was original discovered by Simon Newcomb over fifty years earlier. In addition to his numerous accomplishments in mathematics and astronomy, Newcomb had a fantastic beard.