12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- #ifndef BOOST_RANDOM_RANDOM_NUMBER_GENERATOR_HPP
- #define BOOST_RANDOM_RANDOM_NUMBER_GENERATOR_HPP
- #include <boost/assert.hpp>
- #include <boost/random/uniform_int_distribution.hpp>
- #include <boost/random/detail/disable_warnings.hpp>
- namespace boost {
- namespace random {
- template<class URNG, class IntType = long>
- class random_number_generator
- {
- public:
- typedef URNG base_type;
- typedef IntType argument_type;
- typedef IntType result_type;
-
- random_number_generator(base_type& rng) : _rng(rng) {}
-
-
-
- result_type operator()(argument_type n)
- {
- BOOST_ASSERT(n > 0);
- return uniform_int_distribution<IntType>(0, n-1)(_rng);
- }
- private:
- base_type& _rng;
- };
- }
- using random::random_number_generator;
- }
- #include <boost/random/detail/enable_warnings.hpp>
- #endif
|