Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
1 /* boost random/detail/uniform_int_float.hpp header file
3 * Copyright Jens Maurer 2000-2001
4 * Distributed under the Boost Software License, Version 1.0. (See
5 * accompanying file LICENSE_1_0.txt or copy at
6 * http://www.boost.org/LICENSE_1_0.txt)
8 * See http://www.boost.org for most recent version including documentation.
10 * $Id: uniform_int_float.hpp,v 1.3 2004/07/27 03:43:32 dgregor Exp $
14 #ifndef BOOST_RANDOM_DETAIL_UNIFORM_INT_FLOAT_HPP
15 #define BOOST_RANDOM_DETAIL_UNIFORM_INT_FLOAT_HPP
17 #include <boost/config.hpp>
18 #include <boost/random/uniform_01.hpp>
25 template<class UniformRandomNumberGenerator, class IntType = unsigned long>
26 class uniform_int_float
29 typedef UniformRandomNumberGenerator base_type;
30 typedef IntType result_type;
32 uniform_int_float(base_type rng, IntType min = 0, IntType max = 0xffffffff)
33 : _rng(rng), _min(min), _max(max)
38 result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _min; }
39 result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _max; }
40 base_type& base() { return _rng.base(); }
41 const base_type& base() const { return _rng.base(); }
43 result_type operator()()
45 return static_cast<IntType>(_rng() * _range) + _min;
48 #if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
49 template<class CharT, class Traits>
50 friend std::basic_ostream<CharT,Traits>&
51 operator<<(std::basic_ostream<CharT,Traits>& os, const uniform_int_float& ud)
53 os << ud._min << " " << ud._max;
57 template<class CharT, class Traits>
58 friend std::basic_istream<CharT,Traits>&
59 operator>>(std::basic_istream<CharT,Traits>& is, uniform_int_float& ud)
61 is >> std::ws >> ud._min >> std::ws >> ud._max;
70 _range = static_cast<base_result>(_max-_min)+1;
73 typedef typename base_type::result_type base_result;
74 uniform_01<base_type> _rng;
75 result_type _min, _max;
84 #endif // BOOST_RANDOM_DETAIL_UNIFORM_INT_FLOAT_HPP