# Template Class uniform_real_distribution

- Defined in File hiprand.hpp

## Class Documentation

template<class RealType = float>
class uniform_real_distribution

  Produces random floating-point values uniformly distributed on the interval (0, 1].

  Template Parameters:

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

  Public Types

  typedef RealType result_type

  Public Functions

  inline uniform_real_distribution()

    Default constructor.

  inline void reset()

    Resets distribution’s internal state if there is any.

  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 uniformly distributed random floating-point values.

    Generates `size` random floating-point values uniformly distributed on the interval (0, 1], 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.

    - 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: hiprandGenerateUniform(), hiprandGenerateUniformDouble(), hiprandGenerateUniformHalf()

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

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

  inline bool operator!=(const uniform_real_distribution<RealType> &other)

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