
On 2011-06-28 14:58, Ryan Newton wrote:
These new changes require a small API change to RandomGen. The issue is that the legacy RandomGen API isn't very good at generating random */bits/*. Rather, it next creates numbers in an arbitrary range: genRange. ... I propose that we add a "genBits" function that reports how many bits of randomness are created by a generator.
class RandomGen g where ... genBits :: g -> Int ... What about generators that have a genRange which is not a power of two?
My own feeling is against this change. That's not based on a lot. I once coded up a mechanism that could convert a stream of random numbers from a given sequence of ranges, to another stream of random numbers for ranges as demanded. No randomness was wasted. Nice, clean fun. I don't claim it was particularly efficient. Having worked with that, using bits to organize randomness seems arbitrary.