Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:59:14

0001 /* boost random/uniform_real.hpp header file
0002  *
0003  * Copyright Jens Maurer 2000-2001
0004  * Distributed under the Boost Software License, Version 1.0. (See
0005  * accompanying file LICENSE_1_0.txt or copy at
0006  * http://www.boost.org/LICENSE_1_0.txt)
0007  *
0008  * See http://www.boost.org for most recent version including documentation.
0009  *
0010  * $Id$
0011  *
0012  * Revision history
0013  *  2001-04-08  added min<max assertion (N. Becker)
0014  *  2001-02-18  moved to individual header files
0015  */
0016 
0017 #ifndef BOOST_RANDOM_UNIFORM_REAL_HPP
0018 #define BOOST_RANDOM_UNIFORM_REAL_HPP
0019 
0020 #include <boost/assert.hpp>
0021 #include <boost/config.hpp>
0022 #include <boost/limits.hpp>
0023 #include <boost/random/uniform_real_distribution.hpp>
0024 
0025 namespace boost {
0026 
0027 /**
0028  * The distribution function uniform_real models a random distribution.
0029  * On each invocation, it returns a random floating-point value uniformly
0030  * distributed in the range [min..max).
0031  *
0032  * This class is deprecated.  Please use @c uniform_real_distribution in
0033  * new code.
0034  */
0035 template<class RealType = double>
0036 class uniform_real : public random::uniform_real_distribution<RealType>
0037 {
0038     typedef random::uniform_real_distribution<RealType> base_type;
0039 public:
0040 
0041     class param_type : public base_type::param_type
0042     {
0043     public:
0044         typedef uniform_real distribution_type;
0045         /**
0046          * Constructs the parameters of a uniform_real distribution.
0047          *
0048          * Requires: min <= max
0049          */
0050         explicit param_type(RealType min_arg = RealType(0.0),
0051                             RealType max_arg = RealType(1.0))
0052           : base_type::param_type(min_arg, max_arg)
0053         {}
0054     };
0055 
0056     /**
0057      * Constructs a uniform_real object. @c min and @c max are the
0058      * parameters of the distribution.
0059      *
0060      * Requires: min <= max
0061      */
0062     explicit uniform_real(RealType min_arg = RealType(0.0),
0063                           RealType max_arg = RealType(1.0))
0064       : base_type(min_arg, max_arg)
0065     {
0066         BOOST_ASSERT(min_arg < max_arg);
0067     }
0068 
0069     /** Constructs a uniform_real distribution from its parameters. */
0070     explicit uniform_real(const param_type& parm)
0071       : base_type(parm)
0072     {}
0073 
0074     /** Returns the parameters of the distribution */
0075     param_type param() const { return param_type(this->a(), this->b()); }
0076     /** Sets the parameters of the distribution. */
0077     void param(const param_type& parm) { this->base_type::param(parm); }
0078 };
0079 
0080 } // namespace boost
0081 
0082 #endif // BOOST_RANDOM_UNIFORM_REAL_HPP