Template Class uniform_int_distribution

Class Documentation

template<class IntType = unsigned int>
class uniform_int_distribution

Produces random integer values uniformly distributed on the interval [0, 2^(sizeof(IntType)*8) - 1].

Template Parameters:

IntType – - type of generated values. Only unsigned char, unsigned short and unsigned int and unsigned long long int type is supported.

Public Types

typedef IntType result_type

Public Functions

inline uniform_int_distribution()

Default constructor.

inline void reset()

Resets distribution’s internal state if there is any.

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.

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

Fills output with uniformly distributed random integer values.

Generates size random integer values uniformly distributed on the interval [0, 2^(sizeof(IntType)*8) - 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 IntType type.

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

See also: rocrand_generate(), rocrand_generate_char(), rocrand_generate_short()

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_int_distribution<IntType> &other)

Returns true if the distribution is the same as other.

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

Returns true if the distribution is different from other.