Boost logo

Boost :

From: Jens Maurer (jmaurer_at_[hidden])
Date: 2000-02-16 17:14:06


Back in November last year, Jeet Sukumaran posted a proposal for a
random number library framework. The original proposal was based
on a polymorphic class hierarchy, but most of the people who commented
felt that some template-based solution might be better.

Unfortunately, I haven't received anything about that subject since.

Thus, I have created a new directory "random" in the doc vault and
put up my proposal for a framework:

http://www.egroups.com/docvault/boost/random

Similarities to Jeet Sukumaran's proposal are not entirely coincidental,
however, mine is completely template-based (not a single virtual
function).

I have currently implemented the following generators:
linear congruential (lrand48()-clone, minimal standard (both variants)),
mersenne twister (mt11213b, mt19937) (anew from the paper, not LGPL-
encumbered)

The following distributions are available:
uniform on real [0..1) and [min,max]
geometric, exponential, gaussian, uniform on an n-dimensional sphere

I am aware that the implementation still has its rough edges, but
feel free to comment on that as well.

Here is an overview of the files in the doc vault:

random-concepts.html defines a few concepts in the STL sense. For
example, we've got a UniformRandomNumberGenerator, which is supposed
to do exactly that.

random-classes.html describes concrete templates and classes which
model the concepts.

random.hpp implements the interfaces described in random-classes.html
Note that no coutermeasures against quantization effects have
been implemented yet.

random_device.cpp implements class random_device

random-demo.cpp is a 5-line-program showing how to use the framework
in the most profane way.

histogram.cpp prints histograms of a few popular distributions.

random-test.cpp at least checks that all templates can be instantiated

random-speed.cpp measures the speed of the implementation

Please comment.

Jens Maurer


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