Class template cauchy_distribution

| Home | Libraries | People | FAQ | More

## Class template cauchy_distribution

boost::cauchy_distribution

## Synopsis

    // In header: <boost/random/cauchy_distribution.hpp>

    template<typename RealType = double>
    class cauchy_distribution {
    public:
      // types
      typedef RealType input_type;
      typedef RealType result_type;

      // construct/copy/destruct
      cauchy_distribution(result_type = result_type(0),
                          result_type = result_type(1));

      // public member functions
      result_type median() const;
      result_type sigma() const;
      void reset() ;
      template<typename Engine> result_type operator()(Engine &) ;

      // friend functions
      template<typename CharT, typename Traits>
        friend std::basic_ostream< CharT, Traits > &
        operator<<(std::basic_ostream< CharT, Traits > &,
                   const cauchy_distribution &) ;
      template<typename CharT, typename Traits>
        friend std::basic_istream< CharT, Traits > &
        operator>>(std::basic_istream< CharT, Traits > &, cauchy_distribution &) ;
    };

## Description

The cauchy distribution is a continuous distribution with two parameters, sigma and median.

It has

### `cauchy_distribution` public construct/copy/destruct

1.     cauchy_distribution(result_type median_arg = result_type(0),
                           result_type sigma_arg = result_type(1));

   Constructs a `cauchy_distribution` with the paramters `median` and `sigma`.

### `cauchy_distribution` public member functions

1.     result_type median() const;

   Returns: the "median" parameter of the distribution

2.     result_type sigma() const;

   Returns: the "sigma" parameter of the distribution

3.     void reset() ;

   Effects: Subsequent uses of the distribution do not depend on values produced by any engine prior to invoking reset.

4.     template<typename Engine> result_type operator()(Engine & eng) ;

   Returns: A random variate distributed according to the cauchy distribution.

### `cauchy_distribution` friend functions

1.     template<typename CharT, typename Traits>
         friend std::basic_ostream< CharT, Traits > &
         operator<<(std::basic_ostream< CharT, Traits > & os,
                    const cauchy_distribution & cd) ;

   Writes the parameters of the distribution to a `std::ostream`.

2.     template<typename CharT, typename Traits>
         friend std::basic_istream< CharT, Traits > &
         operator>>(std::basic_istream< CharT, Traits > & is,
                    cauchy_distribution & cd) ;

   Reads the parameters of the distribution from a `std::istream`.