Chris@16: /* boost random/uniform_real.hpp header file Chris@16: * Chris@16: * Copyright Jens Maurer 2000-2001 Chris@16: * Distributed under the Boost Software License, Version 1.0. (See Chris@16: * accompanying file LICENSE_1_0.txt or copy at Chris@16: * http://www.boost.org/LICENSE_1_0.txt) Chris@16: * Chris@16: * See http://www.boost.org for most recent version including documentation. Chris@16: * Chris@101: * $Id$ Chris@16: * Chris@16: * Revision history Chris@16: * 2001-04-08 added min Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: namespace boost { Chris@16: Chris@16: /** Chris@16: * The distribution function uniform_real models a random distribution. Chris@16: * On each invocation, it returns a random floating-point value uniformly Chris@16: * distributed in the range [min..max). Chris@16: * Chris@16: * This class is deprecated. Please use @c uniform_real_distribution in Chris@16: * new code. Chris@16: */ Chris@16: template Chris@16: class uniform_real : public random::uniform_real_distribution Chris@16: { Chris@16: typedef random::uniform_real_distribution base_type; Chris@16: public: Chris@16: Chris@16: class param_type : public base_type::param_type Chris@16: { Chris@16: public: Chris@16: typedef uniform_real distribution_type; Chris@16: /** Chris@16: * Constructs the parameters of a uniform_real distribution. Chris@16: * Chris@16: * Requires: min <= max Chris@16: */ Chris@16: explicit param_type(RealType min_arg = RealType(0.0), Chris@16: RealType max_arg = RealType(1.0)) Chris@16: : base_type::param_type(min_arg, max_arg) Chris@16: {} Chris@16: }; Chris@16: Chris@16: /** Chris@16: * Constructs a uniform_real object. @c min and @c max are the Chris@16: * parameters of the distribution. Chris@16: * Chris@16: * Requires: min <= max Chris@16: */ Chris@16: explicit uniform_real(RealType min_arg = RealType(0.0), Chris@16: RealType max_arg = RealType(1.0)) Chris@16: : base_type(min_arg, max_arg) Chris@16: { Chris@101: BOOST_ASSERT(min_arg < max_arg); Chris@16: } Chris@16: Chris@16: /** Constructs a uniform_real distribution from its parameters. */ Chris@16: explicit uniform_real(const param_type& parm) Chris@16: : base_type(parm) Chris@16: {} Chris@16: Chris@16: /** Returns the parameters of the distribution */ Chris@16: param_type param() const { return param_type(this->a(), this->b()); } Chris@16: /** Sets the parameters of the distribution. */ Chris@16: void param(const param_type& parm) { this->base_type::param(parm); } Chris@16: }; Chris@16: Chris@16: } // namespace boost Chris@16: Chris@16: #endif // BOOST_RANDOM_UNIFORM_REAL_HPP