Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2001-04-01 15:15:33

You might look at boost/libs/utility/numeric_traits_test.hpp, which contains
something to compute min/max at compile-time.


----- Original Message -----
From: <nbecker_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Friday, March 30, 2001 5:01 PM
Subject: [boost] random PN sequence generator

> 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 compile-time log2. (number of bits returned
> by the rng on each invocation = log2 (max - min)). Any ideas?
> To unsubscribe, send email to: <mailto:boost-unsubscribe_at_[hidden]>
> Your use of Yahoo! Groups is subject to

Boost list run by bdawes at, gregod at, cpdaniel at, john at