News for hackers. Stuff that matters.
Re:Efficiently Generating a Number in a Range by duckerude on Wednesday July 25, 2018 @03:49PM (#17612214)
I don't think so.

If you want a number in 1..3, and the generator provides numbers from 1..4, and you want a cap n, then you could model it as a generator that provides numbers in 1..4^n. There's never a way to split that space into three equal parts.

You always end up with unwanted extra possibilities that you still need to handle somehow.

There are no comments on this comment yet.