
Boost : 
From: nbecker_at_[hidden]
Date: 20010330 16:01:35
I need a RNG that generates a sequence of IID bits. Each iterator
should return integers in the range [0..1].
This looks like a job for uniform_smallint  but that would be very
inefficient.
Assuming the underlying generator is good (mt19937), the bits returned
by it have good independence. So what I'd like to do is generate an
int worth (32 bits), cache it, and return 1 bit for each iteration.
But of course, we want to this to be generic. We already have min and
max available at compile time for the underlying generators. But I
don't know how to get a compiletime log2. (number of bits returned
by the rng on each invocation = log2 (max  min)). Any ideas?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk