/usr/include/boost/random
NameSizeModeActions
detail/-0755rm
additive_combine.hpp88260644editdlrm
bernoulli_distribution.hpp56080644editdlrm
beta_distribution.hpp59000644editdlrm
binomial_distribution.hpp129850644editdlrm
cauchy_distribution.hpp65280644editdlrm
chi_squared_distribution.hpp63220644editdlrm
discard_block.hpp79910644editdlrm
discrete_distribution.hpp211370644editdlrm
exponential_distribution.hpp208950644editdlrm
extreme_value_distribution.hpp56110644editdlrm
faure.hpp114740644editdlrm
fisher_f_distribution.hpp59240644editdlrm
gamma_distribution.hpp91660644editdlrm
generate_canonical.hpp29540644editdlrm
geometric_distribution.hpp73390644editdlrm
hyperexponential_distribution.hpp369800644editdlrm
independent_bits.hpp91170644editdlrm
inversive_congruential.hpp95500644editdlrm
lagged_fibonacci.hpp182560644editdlrm
laplace_distribution.hpp57430644editdlrm
linear_congruential.hpp162140644editdlrm
linear_feedback_shift.hpp71620644editdlrm
lognormal_distribution.hpp80510644editdlrm
mersenne_twister.hpp240940644editdlrm
negative_binomial_distribution.hpp69110644editdlrm
niederreiter_base2.hpp117360644editdlrm
non_central_chi_squared_distribution.hpp77240644editdlrm
normal_distribution.hpp174410644editdlrm
piecewise_constant_distribution.hpp171860644editdlrm
piecewise_linear_distribution.hpp188020644editdlrm
poisson_distribution.hpp101450644editdlrm
random_device.hpp50320644editdlrm
random_number_generator.hpp19580644editdlrm
ranlux.hpp32920644editdlrm
seed_seq.hpp37920644editdlrm
shuffle_order.hpp91810644editdlrm
shuffle_output.hpp13520644editdlrm
sobol.hpp77040644editdlrm
student_t_distribution.hpp56330644editdlrm
subtract_with_carry.hpp215900644editdlrm
taus88.hpp11640644editdlrm
traits.hpp41650644editdlrm
triangle_distribution.hpp70330644editdlrm
uniform_01.hpp75380644editdlrm
uniform_int.hpp29090644editdlrm
uniform_int_distribution.hpp161990644editdlrm
uniform_on_sphere.hpp88120644editdlrm
uniform_real.hpp24490644editdlrm
uniform_real_distribution.hpp77260644editdlrm
uniform_smallint.hpp122300644editdlrm
variate_generator.hpp37080644editdlrm
weibull_distribution.hpp55240644editdlrm
xor_combine.hpp70490644editdlrm
Edit: /usr/include/boost/random/random_device.hpp (5032B)
/* boost random/random_device.hpp header file * * Copyright Jens Maurer 2000 * Copyright Steven Watanabe 2010-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) * * $Id$ * * Revision history * 2000-02-18 Portability fixes (thanks to Beman Dawes) */ // See http://www.boost.org/libs/random for documentation. #ifndef BOOST_RANDOM_RANDOM_DEVICE_HPP #define BOOST_RANDOM_RANDOM_DEVICE_HPP #include #include #include #include #include // force autolink to find Boost.System namespace boost { namespace random { /** * Class \random_device models a \nondeterministic_random_number_generator. * It uses one or more implementation-defined stochastic processes to * generate a sequence of uniformly distributed non-deterministic random * numbers. For those environments where a non-deterministic random number * generator is not available, class random_device must not be implemented. See * * @blockquote * "Randomness Recommendations for Security", D. Eastlake, S. Crocker, * J. Schiller, Network Working Group, RFC 1750, December 1994 * @endblockquote * * for further discussions. * * @xmlnote * Some operating systems abstract the computer hardware enough * to make it difficult to non-intrusively monitor stochastic processes. * However, several do provide a special device for exactly this purpose. * It seems to be impossible to emulate the functionality using Standard * C++ only, so users should be aware that this class may not be available * on all platforms. * @endxmlnote * * Implementation Note for Linux * * On the Linux operating system, token is interpreted as a filesystem * path. It is assumed that this path denotes an operating system * pseudo-device which generates a stream of non-deterministic random * numbers. The pseudo-device should never signal an error or end-of-file. * Otherwise, @c std::ios_base::failure is thrown. By default, * \random_device uses the /dev/urandom pseudo-device to retrieve * the random numbers. Another option would be to specify the /dev/random * pseudo-device, which blocks on reads if the entropy pool has no more * random bits available. * * Implementation Note for Windows * * On the Windows operating system, token is interpreted as the name * of a cryptographic service provider. By default \random_device uses * MS_DEF_PROV. * * Performance * * The test program * nondet_random_speed.cpp measures the execution times of the * random_device.hpp implementation of the above algorithms in a tight * loop. The performance has been evaluated on an * Intel(R) Core(TM) i7 CPU Q 840 \@ 1.87GHz, 1867 Mhz with * Visual C++ 2010, Microsoft Windows 7 Professional and with gcc 4.4.5, * Ubuntu Linux 2.6.35-25-generic. * * * * * *
Platformtime per invocation [microseconds]
Windows 2.9
Linux 1.7
* * The measurement error is estimated at +/- 1 usec. */ class random_device : private noncopyable { public: typedef unsigned int result_type; BOOST_STATIC_CONSTANT(bool, has_fixed_range = false); /** Returns the smallest value that the \random_device can produce. */ static result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () { return 0; } /** Returns the largest value that the \random_device can produce. */ static result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () { return ~0u; } /** Constructs a @c random_device, optionally using the default device. */ BOOST_RANDOM_DECL random_device(); /** * Constructs a @c random_device, optionally using the given token as an * access specification (for example, a URL) to some implementation-defined * service for monitoring a stochastic process. */ BOOST_RANDOM_DECL explicit random_device(const std::string& token); BOOST_RANDOM_DECL ~random_device(); /** * Returns: An entropy estimate for the random numbers returned by * operator(), in the range min() to log2( max()+1). A deterministic * random number generator (e.g. a pseudo-random number engine) * has entropy 0. * * Throws: Nothing. */ BOOST_RANDOM_DECL double entropy() const; /** Returns a random value in the range [min, max]. */ BOOST_RANDOM_DECL unsigned int operator()(); /** Fills a range with random 32-bit values. */ template void generate(Iter begin, Iter end) { for(; begin != end; ++begin) { *begin = (*this)(); } } private: class impl; impl * pimpl; }; } // namespace random using random::random_device; } // namespace boost #endif /* BOOST_RANDOM_RANDOM_DEVICE_HPP */