vSMC
vSMC: Scalable Monte Carlo
random.hpp
Go to the documentation of this file.
1 //============================================================================
2 // vSMC/include/vsmc/cxx11/random.hpp
3 //----------------------------------------------------------------------------
4 // vSMC: Scalable Monte Carlo
5 //----------------------------------------------------------------------------
6 // Copyright (c) 2013,2014, Yan Zhou
7 // All rights reserved.
8 //
9 // Redistribution and use in source and binary forms, with or without
10 // modification, are permitted provided that the following conditions are met:
11 //
12 // Redistributions of source code must retain the above copyright notice,
13 // this list of conditions and the following disclaimer.
14 //
15 // Redistributions in binary form must reproduce the above copyright notice,
16 // this list of conditions and the following disclaimer in the documentation
17 // and/or other materials provided with the distribution.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS
20 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 // POSSIBILITY OF SUCH DAMAGE.
30 //============================================================================
31 
32 #ifndef VSMC_CXX11_RANDOM_HPP
33 #define VSMC_CXX11_RANDOM_HPP
34 
35 #include <vsmc/internal/config.hpp>
36 
37 #if VSMC_HAS_CXX11LIB_RANDOM
38 
39 #include <random>
40 
41 namespace vsmc { namespace cxx11 {
42 
43 using std::linear_congruential_engine;
44 using std::mersenne_twister_engine;
45 using std::subtract_with_carry_engine;
46 using std::discard_block_engine;
47 using std::independent_bits_engine;
48 using std::shuffle_order_engine;
49 using std::minstd_rand0;
50 using std::minstd_rand;
51 using std::mt19937;
52 using std::mt19937_64;
53 using std::ranlux24_base;
54 using std::ranlux48_base;
55 using std::ranlux24;
56 using std::ranlux48;
57 using std::knuth_b;
58 using std::default_random_engine;
59 // using std::random_device;
60 using std::seed_seq;
61 using std::generate_canonical;
62 using std::uniform_int_distribution;
63 using std::uniform_real_distribution;
64 using std::bernoulli_distribution;
65 using std::binomial_distribution;
66 using std::geometric_distribution;
67 using std::negative_binomial_distribution;
68 using std::poisson_distribution;
69 using std::exponential_distribution;
70 using std::gamma_distribution;
71 using std::weibull_distribution;
72 using std::extreme_value_distribution;
73 using std::normal_distribution;
74 using std::lognormal_distribution;
75 using std::chi_squared_distribution;
76 using std::cauchy_distribution;
77 using std::fisher_f_distribution;
78 using std::student_t_distribution;
79 using std::discrete_distribution;
80 using std::piecewise_constant_distribution;
81 using std::piecewise_linear_distribution;
82 
83 } } // namespace vsmc::cxx11
84 
85 #else // VSMC_HAS_CXX11LIB_RANDOM
86 
87 #include <boost/random.hpp>
88 #include <boost/cstdint.hpp>
89 
90 namespace vsmc { namespace cxx11 {
91 
92 using ::boost::random::linear_congruential_engine;
93 using ::boost::random::mersenne_twister_engine;
94 using ::boost::random::subtract_with_carry_engine;
95 using ::boost::random::discard_block_engine;
96 using ::boost::random::independent_bits_engine;
97 using ::boost::random::shuffle_order_engine;
98 using ::boost::random::minstd_rand0;
99 using ::boost::random::minstd_rand;
100 using ::boost::random::mt19937;
101 using ::boost::random::mt19937_64;
102 // using ::boost::random::ranlux24_base;
103 typedef ::boost::random::subtract_with_carry_engine<
104  ::boost::uint32_t, 24, 10, 24> ranlux24_base;
105 // using ::boost::random::ranlux48_base;
106 typedef ::boost::random::subtract_with_carry_engine<
107  ::boost::uint64_t, 48, 5, 12> ranlux48_base;
108 using ::boost::random::ranlux24;
109 using ::boost::random::ranlux48;
110 using ::boost::random::knuth_b;
111 // using ::boost::random::default_random_engine;
112 typedef ::boost::random::mt19937 default_random_engine;
113 // using ::boost::random::random_device;
114 using ::boost::random::seed_seq;
115 using ::boost::random::generate_canonical;
116 using ::boost::random::uniform_int_distribution;
117 using ::boost::random::uniform_real_distribution;
118 // using ::boost::random::bernoulli_distribution;
119 typedef ::boost::random::bernoulli_distribution<double> bernoulli_distribution;
120 using ::boost::random::binomial_distribution;
121 using ::boost::random::geometric_distribution;
122 using ::boost::random::negative_binomial_distribution;
123 using ::boost::random::poisson_distribution;
124 using ::boost::random::exponential_distribution;
125 using ::boost::random::gamma_distribution;
126 using ::boost::random::weibull_distribution;
127 using ::boost::random::extreme_value_distribution;
128 using ::boost::random::normal_distribution;
129 using ::boost::random::lognormal_distribution;
130 using ::boost::random::chi_squared_distribution;
131 using ::boost::random::cauchy_distribution;
132 using ::boost::random::fisher_f_distribution;
133 using ::boost::random::student_t_distribution;
134 using ::boost::random::discrete_distribution;
135 using ::boost::random::piecewise_constant_distribution;
136 using ::boost::random::piecewise_linear_distribution;
137 
138 } } //namespace vsmc::cxx11
139 
140 #endif // VSMC_HAS_CXX11LIB_RANDOM
141 
142 #endif // VSMC_CXX11_RANDOM_HPP
Definition: adapter.hpp:37