> On Jul 7, 2018, at 11:49 PM, Keith Medcalf <kmedc...@dessus.com> wrote:
> Why not use MOD (%) as in
> ABS(RANDOM() % 6)
Because modulo bias. If the RHS doesn't evenly divide the size of the range of
RANDOM(), some results will be slightly more likely than others.
Of course in this case, where the range of RANDOM() is probably 2^32, the bias
will be very small. But in some use cases the bias can be magnified by
subsequent operations and can still skew the eventual result. A Google search
turns up several hits that promise fairer algorithms.
sqlite-users mailing list