]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | [library Boost.Random |
2 | [quickbook 1.5] | |
3 | [authors [Maurer, Jens]] | |
4 | [copyright 2000-2005 Jens Maurer, 2009-2010 Steven Watanabe] | |
5 | [license | |
6 | Distributed under the Boost Software License, Version 1.0. | |
7 | (See accompanying file LICENSE_1_0.txt or copy at | |
8 | [@http://www.boost.org/LICENSE_1_0.txt]) | |
9 | ] | |
10 | [purpose A complete system for random number generation] | |
11 | ] | |
12 | ||
13 | [template sup[text]'''<superscript>'''[text]'''</superscript>'''] | |
14 | ||
15 | [template prng[text] [link boost_random.reference.concepts.pseudo_random_number_generator [text]]] | |
16 | [template concepts[text] [link boost_random.reference.concepts [text]]] | |
17 | [template generators[text] [link boost_random.reference.generators [text]]] | |
18 | [template distributions[text] [link boost_random.reference.distributions [text]]] | |
19 | ||
20 | [def __NumberGenerator [link boost_random.reference.concepts.number_generator NumberGenerator]] | |
21 | [def __UniformRandomNumberGenerator [link boost_random.reference.concepts.uniform_random_number_generator UniformRandomNumberGenerator]] | |
22 | [def __PseudoRandomNumberGenerator [link boost_random.reference.concepts.pseudo_random_number_generator PseudoRandomNumberGenerator]] | |
23 | [def __SeedSeq [link boost_random.reference.concepts.seed_sequence SeedSeq]] | |
24 | ||
25 | [def __CopyConstructible [@boost:/doc/html/CopyConstructible.html CopyConstructible]] | |
26 | [def __Assignable [@boost:/doc/html/Assignable.html Assignable]] | |
27 | [def __LessThanComparable [@boost:/doc/html/LessThanComparable.html LessThanComparable]] | |
28 | [def __EqualityComparable [@boost:/doc/html/EqualityComparable.html EqualityComparable]] | |
29 | [def __Streamable Streamable] | |
30 | ||
31 | [def __random_device [classref boost::random::random_device random_device]] | |
32 | [def __random_number_generator [classref boost::random::random_number_generator random_number_generator]] | |
33 | [def __variate_generator [classref boost::random::variate_generator variate_generator]] | |
34 | [def __seed_seq [classref boost::random::seed_seq seed_seq]] | |
35 | [def __generate_canonical [funcref boost::random::generate_canonical generate_canonical]] | |
36 | ||
37 | [def __minstd_rand0 [classref boost::random::minstd_rand0 minstd_rand0]] | |
38 | [def __minstd_rand [classref boost::random::minstd_rand minstd_rand]] | |
39 | [def __rand48 [classref boost::random::rand48 rand48]] | |
40 | [def __ecuyer1988 [classref boost::random::ecuyer1988 ecuyer1988]] | |
41 | [def __kreutzer1986 [classref boost::random::kreutzer1986 kreutzer1986]] | |
42 | [def __knuth_b [classref boost::random::knuth_b knuth_b]] | |
43 | [def __taus88 [classref boost::random::taus88 taus88]] | |
44 | [def __hellekalek1995 [classref boost::random::hellekalek1995 hellekalek1995]] | |
45 | [def __mt11213b [classref boost::random::mt11213b mt11213b]] | |
46 | [def __mt19937 [classref boost::random::mt19937 mt19937]] | |
47 | [def __mt19937_64 [classref boost::random::mt19937_64 mt19937_64]] | |
48 | [def __lagged_fibonacci607 [classref boost::random::lagged_fibonacci607 lagged_fibonacci607]] | |
49 | [def __lagged_fibonacci1279 [classref boost::random::lagged_fibonacci1279 lagged_fibonacci1279]] | |
50 | [def __lagged_fibonacci2281 [classref boost::random::lagged_fibonacci2281 lagged_fibonacci2281]] | |
51 | [def __lagged_fibonacci3217 [classref boost::random::lagged_fibonacci3217 lagged_fibonacci3217]] | |
52 | [def __lagged_fibonacci4423 [classref boost::random::lagged_fibonacci4423 lagged_fibonacci4423]] | |
53 | [def __lagged_fibonacci9689 [classref boost::random::lagged_fibonacci9689 lagged_fibonacci9689]] | |
54 | [def __lagged_fibonacci19937 [classref boost::random::lagged_fibonacci19937 lagged_fibonacci19937]] | |
55 | [def __lagged_fibonacci23209 [classref boost::random::lagged_fibonacci23209 lagged_fibonacci23209]] | |
56 | [def __lagged_fibonacci44497 [classref boost::random::lagged_fibonacci44497 lagged_fibonacci44497]] | |
57 | [def __ranlux3 [classref boost::random::ranlux3 ranlux3]] | |
58 | [def __ranlux4 [classref boost::random::ranlux4 ranlux4]] | |
59 | [def __ranlux64_3 [classref boost::random::ranlux64_3 ranlux64_3]] | |
60 | [def __ranlux64_4 [classref boost::random::ranlux64_4 ranlux64_4]] | |
61 | [def __ranlux3_01 [classref boost::random::ranlux3_01 ranlux3_01]] | |
62 | [def __ranlux4_01 [classref boost::random::ranlux4_01 ranlux4_01]] | |
63 | [def __ranlux64_3_01 [classref boost::random::ranlux64_3_01 ranlux64_3_01]] | |
64 | [def __ranlux64_4_01 [classref boost::random::ranlux64_4_01 ranlux64_4_01]] | |
65 | [def __ranlux24 [classref boost::random::ranlux24 ranlux24]] | |
66 | [def __ranlux48 [classref boost::random::ranlux48 ranlux48]] | |
67 | ||
68 | [def __uniform_smallint [classref boost::random::uniform_smallint uniform_smallint]] | |
69 | [def __uniform_int_distribution [classref boost::random::uniform_int_distribution uniform_int_distribution]] | |
70 | [def __uniform_01 [classref boost::random::uniform_01 uniform_01]] | |
71 | [def __uniform_real_distribution [classref boost::random::uniform_real_distribution uniform_real_distribution]] | |
72 | [def __bernoulli_distribution [classref boost::random::bernoulli_distribution bernoulli_distribution]] | |
73 | [def __beta_distribution [classref boost::random::beta_distribution beta_distribution]] | |
74 | [def __binomial_distribution [classref boost::random::binomial_distribution binomial_distribution]] | |
75 | [def __cauchy_distribution [classref boost::random::cauchy_distribution cauchy_distribution]] | |
76 | [def __discrete_distribution [classref boost::random::discrete_distribution discrete_distribution]] | |
77 | [def __gamma_distribution [classref boost::random::gamma_distribution gamma_distribution]] | |
78 | [def __hyperexponential_distribution [classref boost::random::hyperexponential_distribution hyperexponential_distribution]] | |
79 | [def __laplace_distribution [classref boost::random::laplace_distribution laplace_distribution]] | |
80 | [def __poisson_distribution [classref boost::random::poisson_distribution poisson_distribution]] | |
81 | [def __geometric_distribution [classref boost::random::geometric_distribution geometric_distribution]] | |
82 | [def __triangle_distribution [classref boost::random::triangle_distribution triangle_distribution]] | |
83 | [def __exponential_distribution [classref boost::random::exponential_distribution exponential_distribution]] | |
84 | [def __normal_distribution [classref boost::random::normal_distribution normal_distribution]] | |
85 | [def __lognormal_distribution [classref boost::random::lognormal_distribution lognormal_distribution]] | |
86 | [def __uniform_on_sphere [classref boost::random::uniform_on_sphere uniform_on_sphere]] | |
87 | [def __weibull_distribution [classref boost::random::weibull_distribution weibull_distribution]] | |
88 | [def __extreme_value_distribution [classref boost::random::extreme_value_distribution extreme_value_distribution]] | |
89 | [def __negative_binomial_distribution [classref boost::random::negative_binomial_distribution negative_binomial_distribution]] | |
90 | [def __student_t_distribution [classref boost::random::student_t_distribution student_t_distribution]] | |
91 | [def __fisher_f_distribution [classref boost::random::fisher_f_distribution fisher_f_distribution]] | |
92 | [def __chi_squared_distribution [classref boost::random::chi_squared_distribution chi_squared_distribution]] | |
93 | [def __non_central_chi_squared_distribution [classref boost::random::non_central_chi_squared_distribution non_central_chi_squared_distribution]] | |
94 | [def __piecewise_constant_distribution [classref boost::random::piecewise_constant_distribution piecewise_constant_distribution]] | |
95 | [def __piecewise_linear_distribution [classref boost::random::piecewise_linear_distribution piecewise_linear_distribution]] | |
96 | ||
97 | [include performance_data.qbk] | |
98 | ||
99 | [section Introduction] | |
100 | ||
101 | Random numbers are useful in a variety of applications. The Boost Random | |
102 | Number Library (Boost.Random for short) provides a variety of | |
103 | [generators generators] and [distributions distributions] to produce | |
104 | random numbers having useful properties, such as uniform distribution. | |
105 | ||
106 | You should read the [concepts concepts documentation] for an introduction and the | |
107 | definition of the basic concepts. For a quick start, it may be sufficient | |
108 | to have a look at [@boost:/libs/random/example/random_demo.cpp random_demo.cpp]. | |
109 | ||
110 | For a very quick start, here's an example: | |
111 | ||
112 | ``[classref boost::random::mt19937]`` rng; // produces randomness out of thin air | |
113 | // see pseudo-random number generators | |
114 | ``[classref boost::random::uniform_int_distribution]<>`` six(1,6); | |
115 | // distribution that maps to 1..6 | |
116 | // see random number distributions | |
117 | int x = six(rng); // simulate rolling a die | |
118 | ||
119 | [endsect] | |
120 | ||
121 | [section Tutorial] | |
122 | [include tutorial.qbk] | |
123 | [endsect] | |
124 | ||
125 | [section Reference] | |
126 | ||
127 | [section Concepts] | |
128 | [include concepts.qbk] | |
129 | [endsect] | |
130 | ||
131 | [section Generators] | |
132 | [include generators.qbk] | |
133 | [endsect] | |
134 | ||
135 | [section Distributions] | |
136 | [include distributions.qbk] | |
137 | [endsect] | |
138 | ||
139 | [section Utilities] | |
140 | [include utilities.qbk] | |
141 | [endsect] | |
142 | ||
143 | [xinclude reference.xml] | |
144 | ||
145 | [endsect] | |
146 | ||
147 | [section Performance] | |
148 | [include performance.qbk] | |
149 | [endsect] | |
150 | ||
151 | [section History and Acknowledgements] | |
152 | ||
153 | In November 1999, Jeet Sukumaran proposed a framework based on virtual | |
154 | functions, and later sketched a template-based approach. Ed Brey pointed | |
155 | out that Microsoft Visual C++ does not support in-class member | |
156 | initializations and suggested the enum workaround. Dave Abrahams highlighted | |
157 | quantization issues. | |
158 | ||
159 | The first public release of this random number library materialized in | |
160 | March 2000 after extensive discussions on the boost mailing list. Many | |
161 | thanks to Beman Dawes for his original min_rand class, portability fixes, | |
162 | documentation suggestions, and general guidance. Harry Erwin sent a header | |
163 | file which provided additional insight into the requirements. Ed Brey and | |
164 | Beman Dawes wanted an iterator-like interface. | |
165 | ||
166 | Beman Dawes managed the formal review, during which Matthias Troyer, | |
167 | Csaba Szepesvari, and Thomas Holenstein gave detailed comments. The | |
168 | reviewed version became an official part of boost on 17 June 2000. | |
169 | ||
170 | Gary Powell contributed suggestions for code cleanliness. Dave Abrahams | |
171 | and Howard Hinnant suggested to move the basic generator templates from | |
172 | `namespace boost::detail` to `boost::random`. | |
173 | ||
174 | Ed Brey asked to remove superfluous warnings and helped with `uint64_t` | |
175 | handling. Andreas Scherer tested with MSVC. Matthias Troyer contributed | |
176 | a [headerref boost/random/lagged_fibonacci.hpp lagged Fibonacci generator]. | |
177 | Michael Stevens found a bug in the copy semantics of __normal_distribution | |
178 | and suggested documentation improvements. | |
179 | ||
180 | [endsect] |