# Template Class lognormal_distribution

- Defined in File hiprand.hpp

## Nested Relationships

### Nested Types

- Class lognormal_distribution::param_type

## Class Documentation

template<class RealType = float>
class lognormal_distribution

  Produces positive random numbers according to a log-normal distribution.

  Template Parameters:

    RealType – - type of generated values. Only `float`, `double` and `half` types are supported.

  Public Types

  typedef RealType result_type

  Public Functions

  inline lognormal_distribution(RealType m = 0.0, RealType s = 1.0)

    Constructs a new distribution object.

    Parameters:

      - m – - A mean distribution parameter

      - s – - A standard deviation distribution parameter

  inline lognormal_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 RealType m() const

    Returns the mean distribution parameter.

    The mean specifies the location of the peak. The default value is 0.0.

  inline RealType s() const

    Returns the standard deviation distribution parameter.

    The default value is 1.0.

  inline param_type param() const

    Returns the distribution parameter object.

  inline void param(const param_type &params)

    Sets the distribution parameter object.

  inline RealType min() const

    Returns the smallest possible value that can be generated.

  inline RealType max() const

    Returns the largest possible value that can be generated.

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

    Fills `output` with log-normally distributed random floating-point values.

    Generates `size` random floating-point values (greater than zero) distributed according to a log-normal 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 `RealType` type.

    - Pointer `output` must be aligned to `2 * sizeof(RealType)` bytes.

    - `size` must be even.

    - 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: hiprandGenerateLogNormal(), hiprandGenerateLogNormalDouble(), hiprandGenerateLogNormalHalf()

    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 lognormal_distribution<RealType> &other)

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

    Two distribution are equal, if their parameters are equal.

  inline bool operator!=(const lognormal_distribution<RealType> &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 = lognormal_distribution<RealType>

    Public Functions

    inline param_type(RealType m = 0.0, RealType s = 1.0)
    param_type(const param_type &params) = default
    inline RealType m() const

      Returns the deviation distribution parameter.

      The default value is 1.0.

    inline RealType s() const

      Returns the deviation distribution parameter.

      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`.