Template Class mt19937_engine
Defined in File hiprand.hpp
Class Documentation
-
template<unsigned long long DefaultSeed = HIPRAND_MT19937_DEFAULT_SEED>
class mt19937_engine Pseudorandom number engine based on Mersenne Twister.
mt19937_engine is a random number engine based on the well-known Mersenne Twister algorithm. It produces high quality random numbers of type
unsignedinton the interval [0; 2^32 - 1].Public Types
-
typedef unsigned int result_type
Type of values generated by the random number engine.
Public Functions
-
inline mt19937_engine(seed_type seed_value = DefaultSeed)
Constructs the pseudo-random number engine.
MT19937 engine does not accept offset.
See also: hiprandCreateGenerator()
- Parameters:
seed_value – - seed value to use in the initialization of the internal state, see also seed()
-
inline mt19937_engine(hiprandGenerator_t &generator)
Constructs the pseudo-random number engine.
The pseudo-random number engine will be created using
generator. The constructed engine take ownership overgenerator, and sets passed reference toNULL. The lifetime ofgeneratoris now bound to the lifetime of the engine.- Parameters:
generator – - hipRAND generator
-
mt19937_engine(const mt19937_engine&) = delete
-
mt19937_engine(mt19937_engine&&) = delete
-
mt19937_engine &operator=(const mt19937_engine&) = delete
-
mt19937_engine &operator=(mt19937_engine&&) = delete
-
inline ~mt19937_engine() noexcept(false)
Destructs the engine.
See also: hiprandDestroyGenerator()
-
inline void stream(hipStream_t value)
Sets the random number engine’s
hipStreamfor kernel launches.- Parameters:
value – - new
hipStreamto use
-
inline void seed(seed_type value)
Sets the seed of the pseudo-random number engine.
- This operation resets the engine’s internal state.
This operation does not change the engine’s offset.
See also: hiprandSetPseudoRandomGeneratorSeed()
- Parameters:
value – - New seed value
-
template<class Generator>
inline void operator()(result_type *output, size_t size) Fills
outputwith uniformly distributed random integer values.Generates
sizerandom integer values uniformly distributed on the interval [0, 2^32 - 1], and stores them into the device memory referenced byoutputpointer.The device memory pointed by
outputmust have been previously allocated and be large enough to store at leastsizevalues ofIntTypetype.See also: hiprandGenerate()
- Parameters:
output – - Pointer to device memory to store results
size – - Number of values to generate
-
inline result_type min() const
Returns the smallest possible value that can be generated by the engine.
-
inline result_type max() const
Returns the largest possible value that can be generated by the engine.
Public Static Functions
-
static inline constexpr hiprandRngType type()
Returns type of the hipRAND pseudo-random number generator associated with the engine.
Public Static Attributes
-
static constexpr seed_type default_seed = DefaultSeed
The default seed equal to
DefaultSeed.
-
typedef unsigned int result_type