Boost logo

Boost :

Subject: Re: [boost] [xint] Third release is ready, requesting preliminary review
From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2010-05-02 15:14:34


On 2 May 2010 14:26, Chad Nelson <chad.thecomfychair_at_[hidden]> wrote:
>
> Sorry again, but I wasn't just asking about semantics -- I'm asking what
> you're suggesting the actual code should look like. I'm going through a
> function at least partly so that I can wrap the provided random
> generator to provide the unsigned int type that my code is expecting,
> regardless of what type or size the generator is defined to return,
> without overly complicating things for the user of the library. Look at
> the definition of detail::random_generator in random.hpp to see what I mean.
>

Are you inventing a new method here?

It seems like there's no need for you to define anything new that
models the NumberGenerator concept (or any of the concepts derived rom
that), since there are plenty already
<http://www.boost.org/doc/libs/1_42_0/libs/random/random-generators.html>.

So to fit in the Boost.Random model, you should be providing a new
model of the RandomDistribution concept for generating random primes.
Hopefully your integer class will also work with the uniform_int
<http://www.boost.org/doc/libs/1_42_0/libs/random/random-distributions.html#uniform_int>
distribution, and I'd claim that if it doesn't, that's a bug in either
Boost.Random or your library.

Then the user with use a variate_generator
<http://www.boost.org/doc/libs/1_42_0/libs/random/random-variate.html>
with appropriate template arguments to get what they want. My
suggestion of the default_random_generator would simply be a typedef
to a usual set of these arguments, so people could instantiate one
without needing to know the details, and could then use it like
they're already used to with existing Boost.Random generators.

~ Scott
(who was hopefully clearer that time)


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk