Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/random/index.html @ 13

Last change on this file since 13 was 12, checked in by landauf, 17 years ago

added boost

File size: 7.5 KB
Line 
1<html>
2
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
5
6<title>Boost Random Number Library</title>
7</head>
8
9<body bgcolor="#FFFFFF" text="#000000">
10
11<table border="1" bgcolor="#007F7F" cellpadding="2">
12  <tr>
13    <td bgcolor="#FFFFFF"><img src="../../boost.png" alt="boost.png (6897 bytes)" width="277" height="86"></td>
14    <td><a href="../../index.htm"><font face="Arial,Helvetica" color="#FFFFFF"><big>Home</big></font></a></td>
15    <td><a href="../libraries.htm"><font face="Arial,Helvetica" color="#FFFFFF"><big>Libraries</big></font></a></td>
16    <td><a href="../../people/people.htm"><font face="Arial,Helvetica" color="#FFFFFF"><big>People</big></font></a></td>
17    <td><a href="../../more/faq.htm"><font face="Arial,Helvetica" color="#FFFFFF"><big>FAQ</big></font></a></td>
18    <td><a href="../../more/index.htm"><font face="Arial,Helvetica" color="#FFFFFF"><big>More</big></font></a></td>
19  </tr>
20</table>
21
22<h1>Boost Random Number Library</h1>
23
24Random numbers are useful in a variety of applications.  The Boost
25Random Number Library (Boost.Random for short) provides a vast variety
26of generators and distributions to produce random numbers having
27useful properties, such as uniform distribution. 
28<p>
29You should read the
30<a href="random-concepts.html">concepts documentation</a>
31for an introduction and the definition of the basic concepts.  For a
32quick start, it may be sufficient to have a look at <a
33href="random_demo.cpp">random_demo.cpp</a>.
34<p>
35For a very quick start, here's an example:
36<pre>
37  boost::mt19937 rng;                 // produces randomness out of thin air
38                                      // see pseudo-random number generators
39  boost::uniform_int&lt;> six(1,6)       // distribution that maps to 1..6
40                                      // see random number distributions
41  boost::variate_generator&lt;boost::mt19937&amp;, boost::uniform_int&lt;> >
42           die(rng, six);             // glues randomness with mapping
43  int x = die();                      // simulate rolling a die
44</pre>
45
46<h2>Library Organization</h2>
47
48The library is separated into several header files, all within the
49<code>boost/random/</code> directory.  Additionally, a convenience
50header file which includes all other headers in
51<code>boost/random/</code> is available as
52<code><a href="../../boost/random.hpp">boost/random.hpp</a></code>.
53<p>
54
55A front-end class template called <code>variate_generate</code> is
56provided; please read the
57<a href="random-variate.html">documentation</a> about it.
58<ul>
59<li><code><a href="../../boost/random/variate_generator.hpp">boost/random/variate_generator.hpp</a></code>
60</ul>
61
62Several random number generators are available in the following
63header files; please read the
64<a href="random-generators.html">documentation</a> about these.
65
66<ul>
67<li><code><a href="../../boost/random/linear_congruential.hpp">boost/random/linear_congruential.hpp</a></code>
68<li><code><a href="../../boost/random/additive_combine.hpp">boost/random/additive_combine.hpp</a></code>
69<li><code><a href="../../boost/random/inversive_congruential.hpp">boost/random/inversive_congruential.hpp</a></code>
70<li><code><a href="../../boost/random/shuffle_output.hpp">boost/random/shuffle_output.hpp</a></code>
71<li><code><a href="../../boost/random/mersenne_twister.hpp">boost/random/mersenne_twister.hpp</a></code>
72<li><code><a href="../../boost/random/lagged_fibonacci.hpp">boost/random/lagged_fibonacci.hpp</a></code>
73</ul>
74
75
76Similarly, several random number distributions are available in the
77following header files; please read the
78<a href="random-distributions.html">documentation</a> about these.
79
80<ul>
81<li><code><a href="../../boost/random/uniform_smallint.hpp">boost/random/uniform_smallint.hpp</a></code>
82<li><code><a href="../../boost/random/uniform_int.hpp">boost/random/uniform_int.hpp</a></code>
83<li><code><a href="../../boost/random/uniform_01.hpp">boost/random/uniform_01.hpp</a></code>
84<li><code><a href="../../boost/random/uniform_real.hpp">boost/random/uniform_real.hpp</a></code>
85<li><code><a href="../../boost/random/triangle_distribution.hpp">boost/random/triangle_distribution.hpp</a></code>
86<li><code><a href="../../boost/random/bernoulli_distribution.hpp">boost/random/bernoulli_distribution.hpp</a></code>
87<li><code><a href="../../boost/random/cauchy_distribution.hpp">boost/random/cauchy_distribution.hpp</a></code>
88<li><code><a href="../../boost/random/exponential_distribution.hpp">boost/random/exponential_distribution.hpp</a></code>
89<li><code><a href="../../boost/random/geometric_distribution.hpp">boost/random/geometric_distribution.hpp</a></code>
90<li><code><a href="../../boost/random/normal_distribution.hpp">boost/random/normal_distribution.hpp</a></code>
91<li><code><a href="../../boost/random/lognormal_distribution.hpp">boost/random/lognormal_distribution.hpp</a></code>
92<li><code><a href="../../boost/random/uniform_on_sphere.hpp">boost/random/uniform_on_sphere.hpp</a></code>
93</ul>
94
95Additionally, non-deterministic random number generators are available
96in the header
97<code><a href="../../boost/nondet_random.hpp">&lt;boost/nondet_random.hpp&gt;</a></code>.
98<a href="nondet_random.html">Documentation</a> is also available.
99
100<p>
101
102In order to map the interface of the generators and distribution functions
103to other concepts, some <a href="random-misc.html">decorators</a> are available.
104
105<h2>Tests</h2>
106
107An extensive test suite for the pseudo-random number generators and
108distributions is available as
109<a href="random_test.cpp">random_test.cpp</a>.
110<p>
111Some <a href="random-performance.html">performance results</a> obtained
112using <a href="random_speed.cpp">random_speed.cpp</a> are also available.
113
114<h2>Rationale</h2>
115
116The methods for generating and evaluating deterministic and
117non-deterministic random numbers differ radically.  Furthermore, due
118to the inherent deterministic design of present-day computers, it is
119often difficult to implement non-deterministic random number
120generation facilities.  Thus, the random number library is split into
121separate header files, mirroring the two different application
122domains.
123
124
125<h2>History and Acknowledgements</h2>
126
127In November 1999, Jeet Sukumaran proposed a framework based on virtual
128functions, and later sketched a template-based approach.  Ed Brey
129pointed out that Microsoft Visual C++ does not support in-class member
130initializations and suggested the <code>enum</code> workaround.  Dave
131Abrahams highlighted quantization issues.
132<p>
133The first public release of this random number library materialized in
134March 2000 after extensive discussions on the boost mailing list.
135Many thanks to Beman Dawes for his original <code>min_rand</code>
136class, portability fixes, documentation suggestions, and general
137guidance.  Harry Erwin sent a header file which provided additional
138insight into the requirements.  Ed Brey and Beman Dawes wanted an
139iterator-like interface.
140<p>
141Beman Dawes managed the formal review, during which Matthias Troyer,
142Csaba Szepesvari, and Thomas Holenstein gave detailed comments.  The
143reviewed version became an official part of boost on 17 June 2000.
144<p>
145Gary Powell contributed suggestions for code cleanliness.  Dave
146Abrahams and Howard Hinnant suggested to move the basic generator
147templates from namespace <code>boost::detail</code> to
148<code>boost::random</code>.
149<p>
150Ed Brey asked to remove superfluous warnings and helped with
151<code>uint64_t</code> handling.  Andreas Scherer tested with MSVC.
152Matthias Troyer contributed a lagged Fibonacci generator.  Michael
153Stevens found a bug in the copy semantics of normal_distribution and
154suggested documentation improvements.
155<p>
156<hr>
157<a href="../../people/jens_maurer.htm">Jens Maurer</a>,
1582001-08-31
159
160</body>
161</html>
Note: See TracBrowser for help on using the repository browser.