Boost logo

Boost :

From: Jens Maurer (Jens.Maurer_at_[hidden])
Date: 2001-04-04 15:10:02


alan.rogers_at_[hidden] wrote:
>
> I have written two generators conforming to the
> UniformRandomNumberGenerator specification:

Please send them to me privately. I'm in the progress
of re-working the random number library so every piece
gets its own sub-header, and that makes adding more
generators a little easier. Also, I'd like to review
your submission before putting it in.

Please also send literature references about these two
proposed generators to me privately, which hopefully contain
statistical test results etc.

I hope all generators have validation values contributed
by some trusted source (preferably, the original author)?

And if you've got some meta-level description of the
algorithms used, please send that to me privately as well.

> So far as I can see, all of the methods in random.hpp are defined
> inline. I have initialization routines, however, that are pretty
> large for an inline definition. I would prefer to put them in a .cpp
> file that would have to be compiled and added to some library. Is
> there a reason not to do this?

For the convenience of users, the implementation has been in the
header file only. Currently, no general build system for boost is
available, thus individual libraries need to spend great effort
to provide a build system when they use .cpp files for implementation.
See the regex library as an example. I've avoided the effort so
far.

Also, most random number generators use template techniques, so for
the current level of compiler technology (no support for the
"export" keyword), the definition of the template functions must be
visible when instantiating (i.e. using) the template.

In general, that does not necessarily mean that these functions will
be actually inlined in the compiled code. When members of a class
template are defined out of the class they are a member of and without
specifying the "inline" keyword, there's a good chance the function
will not be inlined. For example, "gcc" inlines these function only
when specifying the compiler option "-finline-functions" or "-O3".
In random.hpp, I have been careful to properly apply the "inline"
keyword in cases where I considered it worthwile (see
mersenne_twister::twist() vs. mersenne_twister::operator()()).

Jens Maurer


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