Why not use regular rejection sampling when `limit` is known at compile-time.
Does fastrange[1] have fewer rejections due to any excess random bits[2]?
Fastrange is slightly biased because, as Steve Canon observes in that Swift PR, it is just Knuth’s multiplicative reduction. The point of this post is that it’s possible to simplify Lemire’s nearly-divisionless debiasing when the limit is known at compile time.
The code blocks break mobile viewport width. Surely it's better than wrapping, but the best solution is to use max-width and overflow-x: auto which makes them scrollable.
[1] https://github.com/lemire/fastrange
[2] https://github.com/swiftlang/swift/pull/39143
reply