Remove modulo bias
Opened this issue · 0 comments
shadikka commented
Use rejection sampling and modulo reduction instead of
Line 18 in 84e098f
Essentially for the length of wordlist l
, find the the largest n
where l * n
still fits in a usize
(note: you need to detect the size of usize
at compilation time), reject all random samples r
above l * n
and then accept WORDLIST[r % l]
.