# Template Class poisson_distribution

- Defined in File hiprand.hpp

## Nested Relationships

### Nested Types

- Class poisson_distribution::param_type

## Class Documentation

template<class IntType = unsigned int>
class poisson_distribution

  Produces random non-negative integer values distributed according to Poisson distribution.

  Template Parameters:

    IntType – - type of generated values. Only `unsinged` `int` type is supported.

  Public Types

  typedef IntType result_type

  Public Functions

  inline poisson_distribution(double mean = 1.0)

    Constructs a new distribution object.

    Parameters:

      mean – - A mean distribution parameter.

  inline poisson_distribution(const param_type &params)

    Constructs a new distribution object.

    Parameters:

      params – - Distribution parameters

  inline void reset()

    Resets distribution’s internal state if there is any.

  inline double mean() const

    Returns the mean distribution parameter.

    The mean (also known as lambda) is the average number of events per interval. The default value is 1.0.

  inline IntType min() const

    Returns the smallest possible value that can be generated.

  inline IntType max() const

    Returns the largest possible value that can be generated.

  inline param_type param() const

    Returns the distribution parameter object.

  inline void param(const param_type &params)

    Sets the distribution parameter object.

  template<class Generator>
  inline void operator()(Generator &g, IntType *output, size_t size)

    Fills `output` with random non-negative integer values distributed according to Poisson distribution.

    Generates `size` random non-negative integer values distributed according to Poisson distribution, and stores them into the device memory referenced by `output` pointer.

    Requirements:

    - The device memory pointed by `output` must have been previously allocated and be large enough to store at least `size` values of `IntType` type.

    - If generator `g` is a quasi-random number generator (`hiprand_cpp::sobol32_engine`), then `size` must be a multiple of that generator’s dimension.

    See also: hiprandGeneratePoisson()

    Parameters:

      - g – - An uniform random number generator object

      - output – - Pointer to device memory to store results

      - size – - Number of values to generate

  inline bool operator==(const poisson_distribution<IntType> &other)

    Returns `true` if the distribution is the same as `other`.

    Two distribution are equal, if their parameters are equal.

  inline bool operator!=(const poisson_distribution<IntType> &other)

    Returns `true` if the distribution is different from `other`.

    Two distribution are equal, if their parameters are equal.

  class param_type

    The type of the distribution parameter set.

    Public Types

    using distribution_type = poisson_distribution<IntType>

    Public Functions

    inline param_type(double mean = 1.0)
    param_type(const param_type &params) = default
    inline double mean() const

      Returns the mean distribution parameter.

      The mean (also known as lambda) is the average number of events per interval. The default value is 1.0.

    inline bool operator==(const param_type &other)

      Returns `true` if the param_type is the same as `other`.

    inline bool operator!=(const param_type &other)

      Returns `true` if the param_type is different from `other`.