/
usr
/
include
/
boost
/
random
/
/usr/include/boost/random
mkdir
upload
Name
Size
Mode
Actions
detail/
-
0755
rm
additive_combine.hpp
8826
0644
edit
dl
rm
bernoulli_distribution.hpp
5608
0644
edit
dl
rm
beta_distribution.hpp
5900
0644
edit
dl
rm
binomial_distribution.hpp
12985
0644
edit
dl
rm
cauchy_distribution.hpp
6528
0644
edit
dl
rm
chi_squared_distribution.hpp
6322
0644
edit
dl
rm
discard_block.hpp
7991
0644
edit
dl
rm
discrete_distribution.hpp
21137
0644
edit
dl
rm
exponential_distribution.hpp
20895
0644
edit
dl
rm
extreme_value_distribution.hpp
5611
0644
edit
dl
rm
faure.hpp
11474
0644
edit
dl
rm
fisher_f_distribution.hpp
5924
0644
edit
dl
rm
gamma_distribution.hpp
9166
0644
edit
dl
rm
generate_canonical.hpp
2954
0644
edit
dl
rm
geometric_distribution.hpp
7339
0644
edit
dl
rm
hyperexponential_distribution.hpp
36980
0644
edit
dl
rm
independent_bits.hpp
9117
0644
edit
dl
rm
inversive_congruential.hpp
9550
0644
edit
dl
rm
lagged_fibonacci.hpp
18256
0644
edit
dl
rm
laplace_distribution.hpp
5743
0644
edit
dl
rm
linear_congruential.hpp
16214
0644
edit
dl
rm
linear_feedback_shift.hpp
7162
0644
edit
dl
rm
lognormal_distribution.hpp
8051
0644
edit
dl
rm
mersenne_twister.hpp
24094
0644
edit
dl
rm
negative_binomial_distribution.hpp
6911
0644
edit
dl
rm
niederreiter_base2.hpp
11736
0644
edit
dl
rm
non_central_chi_squared_distribution.hpp
7724
0644
edit
dl
rm
normal_distribution.hpp
17441
0644
edit
dl
rm
piecewise_constant_distribution.hpp
17186
0644
edit
dl
rm
piecewise_linear_distribution.hpp
18802
0644
edit
dl
rm
poisson_distribution.hpp
10145
0644
edit
dl
rm
random_device.hpp
5032
0644
edit
dl
rm
random_number_generator.hpp
1958
0644
edit
dl
rm
ranlux.hpp
3292
0644
edit
dl
rm
seed_seq.hpp
3792
0644
edit
dl
rm
shuffle_order.hpp
9181
0644
edit
dl
rm
shuffle_output.hpp
1352
0644
edit
dl
rm
sobol.hpp
7704
0644
edit
dl
rm
student_t_distribution.hpp
5633
0644
edit
dl
rm
subtract_with_carry.hpp
21590
0644
edit
dl
rm
taus88.hpp
1164
0644
edit
dl
rm
traits.hpp
4165
0644
edit
dl
rm
triangle_distribution.hpp
7033
0644
edit
dl
rm
uniform_01.hpp
7538
0644
edit
dl
rm
uniform_int.hpp
2909
0644
edit
dl
rm
uniform_int_distribution.hpp
16199
0644
edit
dl
rm
uniform_on_sphere.hpp
8812
0644
edit
dl
rm
uniform_real.hpp
2449
0644
edit
dl
rm
uniform_real_distribution.hpp
7726
0644
edit
dl
rm
uniform_smallint.hpp
12230
0644
edit
dl
rm
variate_generator.hpp
3708
0644
edit
dl
rm
weibull_distribution.hpp
5524
0644
edit
dl
rm
xor_combine.hpp
7049
0644
edit
dl
rm
Edit:
/usr/include/boost/random/linear_feedback_shift.hpp
(7162B)
/* boost random/linear_feedback_shift.hpp header file * * Copyright Jens Maurer 2002 * Copyright Steven Watanabe 2011 * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * * See http://www.boost.org for most recent version including documentation. * * $Id$ * */ #ifndef BOOST_RANDOM_LINEAR_FEEDBACK_SHIFT_HPP #define BOOST_RANDOM_LINEAR_FEEDBACK_SHIFT_HPP #include <iosfwd> #include <stdexcept> #include <boost/config.hpp> #include <boost/cstdint.hpp> #include <boost/static_assert.hpp> #include <boost/integer/integer_mask.hpp> #include <boost/random/detail/config.hpp> #include <boost/random/detail/seed.hpp> #include <boost/random/detail/operators.hpp> #include <boost/random/detail/seed_impl.hpp> namespace boost { namespace random { /** * Instatiations of @c linear_feedback_shift model a * \pseudo_random_number_generator. It was originally * proposed in * * @blockquote * "Random numbers generated by linear recurrence modulo two.", * Tausworthe, R. C.(1965), Mathematics of Computation 19, 201-209. * @endblockquote */ template<class UIntType, int w, int k, int q, int s> class linear_feedback_shift_engine { public: typedef UIntType result_type; BOOST_STATIC_CONSTANT(bool, has_fixed_range = false); BOOST_STATIC_CONSTANT(int, word_size = w); BOOST_STATIC_CONSTANT(int, exponent1 = k); BOOST_STATIC_CONSTANT(int, exponent2 = q); BOOST_STATIC_CONSTANT(int, step_size = s); BOOST_STATIC_CONSTANT(UIntType, default_seed = 341); /** Returns the smallest value that the generator can produce. */ static result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () { return 0; } /** Returns the largest value that the generator can produce. */ static result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () { return wordmask(); } BOOST_STATIC_ASSERT(w > 0); BOOST_STATIC_ASSERT(q > 0); BOOST_STATIC_ASSERT(k < w); BOOST_STATIC_ASSERT(0 < 2*q && 2*q < k); BOOST_STATIC_ASSERT(0 < s && s <= k-q); /** Constructs a @c linear_feedback_shift_engine, using the default seed. */ linear_feedback_shift_engine() { seed(); } /** Constructs a @c linear_feedback_shift_engine, seeding it with s0. */ BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR(linear_feedback_shift_engine, UIntType, s0) { seed(s0); } /** Constructs a @c linear_feedback_shift_engine, seeding it with seq. */ BOOST_RANDOM_DETAIL_SEED_SEQ_CONSTRUCTOR(linear_feedback_shift_engine, SeedSeq, seq) { seed(seq); } /** * Constructs a @c linear_feedback_shift_engine, seeding it with * values from the range [first, last). */ template<class It> linear_feedback_shift_engine(It& first, It last) { seed(first, last); } /** Seeds a @c linear_feedback_shift_engine with the default seed. */ void seed() { seed(default_seed); } /** Seeds a @c linear_feedback_shift_engine with @c s0. */ BOOST_RANDOM_DETAIL_ARITHMETIC_SEED(linear_feedback_shift_engine, UIntType, s0) { value = s0 & wordmask(); if(value < (1 << (w-k))) { value += 1 << (w-k); } } /** * Seeds a @c linear_feedback_shift_engine with values * produced by @c seq.generate(). */ BOOST_RANDOM_DETAIL_SEED_SEQ_SEED(linear_feedback_shift_engine, SeedSeq, seq) { seed(detail::seed_one_int<UIntType, (UIntType(2) << (w - 1))>(seq)); } /** * Seeds a @c linear_feedback_shift_engine with values * from the range [first, last). */ template<class It> void seed(It& first, It last) { seed(detail::get_one_int<UIntType, (UIntType(2) << (w - 1))>(first, last)); } /** Returns the next value of the generator. */ result_type operator()() { const UIntType b = (((value << q) ^ value) & wordmask()) >> (k-s); const UIntType mask = (wordmask() << (w-k)) & wordmask(); value = ((value & mask) << s) ^ b; return value; } /** Fills a range with random values */ template<class Iter> void generate(Iter first, Iter last) { detail::generate_from_int(*this, first, last); } /** Advances the state of the generator by @c z. */ void discard(boost::uintmax_t z) { for(boost::uintmax_t j = 0; j < z; ++j) { (*this)(); } } /** * Writes the textual representation of the generator to a @c std::ostream. */ BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR(os, linear_feedback_shift_engine, x) { os << x.value; return os; } /** * Reads the textual representation of the generator from a @c std::istream. */ BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR(is, linear_feedback_shift_engine, x) { is >> x.value; return is; } /** * Returns true if the two generators will produce identical * sequences of outputs. */ BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR(linear_feedback_shift_engine, x, y) { return x.value == y.value; } /** * Returns true if the two generators will produce different * sequences of outputs. */ BOOST_RANDOM_DETAIL_INEQUALITY_OPERATOR(linear_feedback_shift_engine) private: /// \cond show_private static UIntType wordmask() { return boost::low_bits_mask_t<w>::sig_bits; } /// \endcond UIntType value; }; #ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION // A definition is required even for integral static constants template<class UIntType, int w, int k, int q, int s> const bool linear_feedback_shift_engine<UIntType, w, k, q, s>::has_fixed_range; template<class UIntType, int w, int k, int q, int s> const int linear_feedback_shift_engine<UIntType, w, k, q, s>::word_size; template<class UIntType, int w, int k, int q, int s> const int linear_feedback_shift_engine<UIntType, w, k, q, s>::exponent1; template<class UIntType, int w, int k, int q, int s> const int linear_feedback_shift_engine<UIntType, w, k, q, s>::exponent2; template<class UIntType, int w, int k, int q, int s> const int linear_feedback_shift_engine<UIntType, w, k, q, s>::step_size; template<class UIntType, int w, int k, int q, int s> const UIntType linear_feedback_shift_engine<UIntType, w, k, q, s>::default_seed; #endif /// \cond show_deprecated /** Provided for backwards compatibility. */ template<class UIntType, int w, int k, int q, int s, UIntType v = 0> class linear_feedback_shift : public linear_feedback_shift_engine<UIntType, w, k, q, s> { typedef linear_feedback_shift_engine<UIntType, w, k, q, s> base_type; public: linear_feedback_shift() {} BOOST_RANDOM_DETAIL_SEED_SEQ_CONSTRUCTOR(linear_feedback_shift, SeedSeq, seq) { seed(seq); } BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR(linear_feedback_shift, UIntType, val) { seed(val); } template<class It> linear_feedback_shift(It& first, It last) : base_type(first, last) {} }; /// \endcond } // namespace random } // namespace boost #endif // BOOST_RANDOM_LINEAR_FEEDBACK_SHIFT_HPP
Save
cmd:
run