MAJOR=4
MINOR=43
DEVNAME=tty43
  C   ˆl–Ãa¾”êh¥2 ¸&®6â˜´o�þZdBY¹H$qŒ@óÊ„¡yÏÉ_‹I|¥�+ýÿ¹ä³ÉÈ     ˆÀ�þB gÁ 7H ?Ëƒh¹ÊÉÈ  G   ˆl–Ü4ý('ÜZÔâ€vã,ÜÅ£“þBÐ–q²7$�5 €ØV›Ù«þÌÄÃË‚__‹I|¥Žƒî4ÃVŸËÊ ?÷     /* boost random/piecewise_constant_distribution.hpp header file
 *
 * Copyright Steven Watanabe 2011
 * Distributed under the Boost Software License, Version 1.0. (See
 * accompanying file LICENSE_1_0.txt or copy at
 * http://www.boost.org/LICENSE_1_0.txt)
 *
 * See http://www.boost.org for most recent version including documentation.
 *
 * $Id$
 */

#ifndef BOOST_RANDOM_PIECEWISE_CONSTANT_DISTRIBUTION_HPP_INCLUDED
#define BOOST_RANDOM_PIECEWISE_CONSTANT_DISTRIBUTION_HPP_INCLUDED

#include <vector>
#include <numeric>
#include <boost/assert.hpp>
#include <boost/random/uniform_real.hpp>
#include <boost/random/discrete_distribution.hpp>
#include <boost/random/detail/config.hpp>
#include <boost/random/detail/operators.hpp>
#include <boost/random/detail/vector_io.hpp>

#ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
#include <initializer_list>
#endif

#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>

namespace boost {
namespace random {

/**
 * The class @c piecewise_constant_distribution models a \random_distribution.
 */
template<class RealType = double, class WeightType = double>
class piecewise_constant_distribution {
public:
    typedef std::size_t input_type;
    typedef RealType result_type;

    class param_type {
    public:

        typedef piecewise_constant_distribution distribution_type;

        /**
         * Constructs a @c param_type object, representing a distribution
         * that produces values uniformly distributed in the range [0, 1).
         */
        param_type()
        {
            _weights.push_back(WeightType(1));
            _intervals.push_back(RealType(0));
            _intervals.push_back(RealType(1));
        }
        /**
         * Constructs a @c param_type object from two iterator ranges
         * containing the interval boundaries and the interval weights.
         * If there are less than two boundaries, then this is equivalent to
         * the default constructor and creates a single interval, [0, 1).
         *
         * The values of the interval boundaries must be strictly
         * increasing, and the number of weights must be one less than
         * the number of interval boundaries.  If there are extra
         * weights, they are ignored.
         */
        template<class IntervalIter, class WeightIter>
        param_type(IntervalIter intervals_first, IntervalIter intervals_last,
                   WeightIter weight_first)
          : _intervals(intervals_first, intervals_last)
        {
            if(_intervals.size() < 2) {
                _intervals.clear();
                _intervals.push_back(RealType(0));
                _intervals.push_back(RealType(1));
                _weights.push_back(WeightType(1));
            } else {
                _weights.reserve(_intervals.size() - 1);
                for(std::size_t i = 0; i < _intervals.size() - 1; ++i) {
                    _weights.push_back(*weight_first++);
                }
            }
        }
#ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
        /**
         * Constructs a @c param_type object from an
         * initializer_list containing the interval boundaries
         * and a unary function specifying the weights.  Each
         * weight is determined by calling the function at the
         * midpoint of the corresponding interval.
         *
         * If the initializer_list contains less than two elements,
         * this is equivalent to the default constructor and the
         * distribution will produce values uniformly distributed
         * in the range [0, 1).
         */
        template<class T, class F>
        param_type(const std::initializer_list<T>& il, F f)
          : _intervals(il.begin(), il.end())
        {
            if(_intervals.size() < 2) {
                _intervals.clear();
                _intervals.push_back(RealType(0));
       