X-Git-Url: https://git.donarmstrong.com/?p=rsem.git;a=blobdiff_plain;f=boost%2Frandom%2Funiform_01.hpp;fp=boost%2Frandom%2Funiform_01.hpp;h=d32a08546fe2a3b5e290075b29a9cf76ef7ffe37;hp=2cdd05f6519327a7d146b92a5f6a131a0fc1fb4b;hb=2d71eb92104693ca9baa5a2e1c23eeca776d8fd3;hpb=da57529b92adbb7ae74a89861cb39fb35ac7c62d diff --git a/boost/random/uniform_01.hpp b/boost/random/uniform_01.hpp index 2cdd05f..d32a085 100644 --- a/boost/random/uniform_01.hpp +++ b/boost/random/uniform_01.hpp @@ -7,7 +7,7 @@ * * See http://www.boost.org for most recent version including documentation. * - * $Id: uniform_01.hpp 60755 2010-03-22 00:45:06Z steven_watanabe $ + * $Id: uniform_01.hpp 71018 2011-04-05 21:27:52Z steven_watanabe $ * * Revision history * 2001-02-18 moved to individual header files @@ -21,11 +21,12 @@ #include #include #include -#include +#include #include namespace boost { +namespace random { #ifdef BOOST_RANDOM_DOXYGEN @@ -121,7 +122,6 @@ template class backward_compatible_uniform_01 { typedef boost::random::detail::ptr_helper traits; - typedef boost::random::detail::pass_through_engine internal_engine_type; public: typedef UniformRandomNumberGenerator base_type; typedef RealType result_type; @@ -135,7 +135,7 @@ public: explicit backward_compatible_uniform_01(typename traits::rvalue_type rng) : _rng(rng), _factor(result_type(1) / - (result_type((_rng.max)()-(_rng.min)()) + + (result_type((base().max)()-(base().min)()) + result_type(std::numeric_limits::is_integer ? 1 : 0))) { } @@ -143,13 +143,13 @@ public: result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return result_type(0); } result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return result_type(1); } - typename traits::value_type& base() { return _rng.base(); } - const typename traits::value_type& base() const { return _rng.base(); } + typename traits::value_type& base() { return traits::ref(_rng); } + const typename traits::value_type& base() const { return traits::ref(_rng); } void reset() { } result_type operator()() { for (;;) { - result_type result = result_type(_rng() - (_rng.min)()) * _factor; + result_type result = result_type(base()() - (base().min)()) * _factor; if (result < result_type(1)) return result; } @@ -174,8 +174,8 @@ public: #endif private: - typedef typename internal_engine_type::result_type base_result; - internal_engine_type _rng; + typedef typename traits::value_type::result_type base_result; + UniformRandomNumberGenerator _rng; result_type _factor; }; @@ -266,6 +266,10 @@ public: #endif +} // namespace random + +using random::uniform_01; + } // namespace boost #include