Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/random/random-misc.html @ 35

Last change on this file since 35 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 3.4 KB
Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
3<html>
4<head>
5  <meta http-equiv="Content-Language" content="en-us">
6  <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
7
8  <title>Boost Random Number Generator Library (Miscellaneous)</title>
9</head>
10
11<body bgcolor="#FFFFFF" text="#000000">
12  <h1>Random Number Generator Library --- Miscellaneous Decorators</h1>
13
14  <ul>
15    <li><a href="#random_number_generator">Class template
16    <code>random_number_generator</code></a></li>
17  </ul>
18
19  <h2>Introduction</h2>
20
21  <p>These decorator class templates allow adaptation of the random number
22  generators and distribution functions to concepts found in the C++ Standard
23  Library, in particular the RandomNumberGenerator and the InputIterator
24  concepts. The latter adaptation is useful, because the the basic random
25  number generators do not implement the InputIterator requirements per se,
26  in contrast to the distribution functions.</p>
27
28  <h2><a name="synopsis" id="synopsis">Synopsis</a> of miscellaneous
29  decorators in header <code>&lt;boost/random.hpp&gt;</code></h2>
30  <pre>
31namespace boost {
32  template&lt;class UniformRandomNumberGenerator, class IntType = long&gt;
33  class random_number_generator;
34} // namespace boost
35</pre>
36
37  <h2><a name="random_number_generator" id="random_number_generator">Class
38  template <code>random_number_generator</code></a></h2>
39
40  <h3>Synopsis</h3>
41  <pre>
42template&lt;class UniformRandomNumberGenerator, class IntType = long&gt;
43class random_number_generator
44{
45public:
46  typedef UniformRandomNumberGenerator base_type;
47  typedef IntType argument_type;
48  typedef IntType result_type;
49  random_number_generator(base_type &amp; rng);
50  result_type operator()(argument_type n);
51};
52</pre>
53
54  <h3>Description</h3>
55
56  <p>Instantiations of class template <code>random_number_generator</code>
57  model a RandomNumberGenerator (std:25.2.11 [lib.alg.random.shuffle]). On
58  each invocation, it returns a uniformly distributed integer in the range
59  [0..<code>n</code>).</p>
60
61  <p>The template parameter <code>IntType</code> shall denote some
62  integer-like value type.</p>
63
64  <p><em>Note:</em> I consider it unfortunate that the C++ Standard uses the
65  name RandomNumberGenerator for something rather specific.</p>
66
67  <h3>Members</h3>
68  <pre>
69random_number_generator(base_type &amp; rng)
70</pre>
71
72  <p><strong>Effects:</strong> Constructs a
73  <code>random_number_generator</code> functor with the given uniform random
74  number generator as the underlying source of random numbers.</p>
75  <pre>
76result_type operator()(argument_type n)
77</pre>
78
79  <p><strong>Returns:</strong> The value of
80  <code>uniform_int&lt;base_type&gt;(rng, 0, n-1)()</code>.</p>
81  <hr>
82
83  <p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
84  "http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional"
85  height="31" width="88"></a></p>
86
87  <p>Revised
88  <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->05
89  December, 2006<!--webbot bot="Timestamp" endspan i-checksum="38516" --></p>
90
91  <p><i>Copyright &copy; 2000-2005 <a href=
92  "../../people/jens_maurer.htm">Jens Maurer</a></i></p>
93
94  <p><i>Distributed under the Boost Software License, Version 1.0. (See
95  accompanying file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
96  copy at <a href=
97  "http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</i></p>
98</body>
99</html>
Note: See TracBrowser for help on using the repository browser.