On Saturday, 4 January 2014 at 21:48:02 UTC, bearophile wrote:
Jeroen Bollen:
Divisions for every result would be expensive, and shifting
the output wouldn't return a uniform distribution.
If the ulong is uniform, then every of its ubytes is uniform.
So "& ubyte.max" could suffice. If that's not good enough for
you, then you can xor together the eight ubytes of the ulong
with some masking & shifts :-)
Bye,
bearophile
Oops yeah sorry, I was thinking there is more chance to get a
small number and thus more chance for there being zeros up front,
but actually there is as much chance due there being as many
numbers started with 1 as with 0. Thanks for the help. :D