1 /* boost random/uniform_real.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.
13 * 2001-04-08 added min<max assertion (N. Becker)
14 * 2001-02-18 moved to individual header files
17 #ifndef BOOST_RANDOM_UNIFORM_REAL_HPP
18 #define BOOST_RANDOM_UNIFORM_REAL_HPP
20 #include <boost/assert.hpp>
21 #include <boost/config.hpp>
22 #include <boost/limits.hpp>
23 #include <boost/random/uniform_real_distribution.hpp>
28 * The distribution function uniform_real models a random distribution.
29 * On each invocation, it returns a random floating-point value uniformly
30 * distributed in the range [min..max).
32 * This class is deprecated. Please use @c uniform_real_distribution in
35 template<class RealType = double>
36 class uniform_real : public random::uniform_real_distribution<RealType>
38 typedef random::uniform_real_distribution<RealType> base_type;
41 class param_type : public base_type::param_type
44 typedef uniform_real distribution_type;
46 * Constructs the parameters of a uniform_real distribution.
48 * Requires: min <= max
50 explicit param_type(RealType min_arg = RealType(0.0),
51 RealType max_arg = RealType(1.0))
52 : base_type::param_type(min_arg, max_arg)
57 * Constructs a uniform_real object. @c min and @c max are the
58 * parameters of the distribution.
60 * Requires: min <= max
62 explicit uniform_real(RealType min_arg = RealType(0.0),
63 RealType max_arg = RealType(1.0))
64 : base_type(min_arg, max_arg)
66 BOOST_ASSERT(min_arg < max_arg);
69 /** Constructs a uniform_real distribution from its parameters. */
70 explicit uniform_real(const param_type& parm)
74 /** Returns the parameters of the distribution */
75 param_type param() const { return param_type(this->a(), this->b()); }
76 /** Sets the parameters of the distribution. */
77 void param(const param_type& parm) { this->base_type::param(parm); }
82 #endif // BOOST_RANDOM_UNIFORM_REAL_HPP