35#ifndef _BLAZE_UTIL_RANDOM_H_
36#define _BLAZE_UTIL_RANDOM_H_
133template<
typename T >
136template<
typename T,
typename... Args >
137T
rand( Args&&... args );
139template<
typename T >
142template<
typename T,
typename... Args >
143void randomize( T&& value, Args&&... args );
147template<
typename RNG = DefaultRNG >
150template<
typename RNG = DefaultRNG >
176template<
typename RNG = DefaultRNG >
191 template<
typename,
typename >
friend class Rand;
250template<
typename T >
264 std::uniform_int_distribution<T> dist( 0, std::numeric_limits<T>::max() );
284 std::uniform_int_distribution<T> dist(
min,
max );
343template<
typename T >
356 std::uniform_real_distribution<T> dist( 0.0, 1.0 );
376 std::uniform_real_distribution<T> dist(
min,
max );
433template<
typename T >
434class Rand< complex<T> >
445 inline const complex<T>
generate()
const
448 return complex<T>( tmp.generate(), tmp.generate() );
465 inline const complex<T>
generate(
const T&
min,
const T&
max )
const
468 return complex<T>( tmp.generate(
min,
max ), tmp.generate(
min,
max ) );
488 inline const complex<T>
generate(
const T& realmin,
const T& realmax,
489 const T& imagmin,
const T& imagmax )
const
492 return complex<T>( tmp.generate( realmin, realmax ), tmp.generate( imagmin, imagmax ) );
505 inline void randomize( complex<T>& value )
const
525 inline void randomize( complex<T>& value,
const T&
min,
const T&
max )
const
549 inline void randomize( complex<T>& value,
const T& realmin,
const T& realmax,
550 const T& imagmin,
const T& imagmax )
const
552 value =
generate( realmin, realmax, imagmin, imagmax );
582template<
typename T >
586 return tmp.generate();
605 return tmp.generate( std::forward<Args>( args )... );
625template<
typename T >
629 tmp.randomize( std::forward<T>( value ) );
649 tmp.randomize( std::forward<T>( value ), std::forward<Args>( args )... );
674template<
typename RNG >
692template<
typename RNG >
Header file for run time assertion macros.
Header file for the complex data type.
Header file for the EnableIf class template.
Header file for the IsFloatingPoint type trait.
Header file for the IsIntegral type trait.
Base class for non-creatable (static) classes.
Header file for the RemoveCVRef type trait.
Header file for the RemoveCV type trait.
NonCreatable()=delete
Constructor (explicitly deleted).
Default implementation of the Rand class.
Definition Random.h:230
Random number generator.
Definition Random.h:179
static uint32_t seed_
The current seed for the variate generator.
Definition Random.h:184
static RNG rng_
The mersenne twister variate generator.
Definition Random.h:185
32-bit unsigned integer type of the Blaze library.
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition DMatDMatMapExpr.h:1339
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition DMatDMatMapExpr.h:1375
decltype(auto) generate(size_t m, size_t n, OP op)
Generates a new dense matrix filled via the given custom binary operation.
Definition DMatGenExpr.h:675
T rand()
Random number function.
Definition Random.h:583
uint32_t defaultSeed()
Returns the default random seed.
Definition Random.h:660
uint32_t getSeed()
Returns the current seed of the random number generator.
Definition Random.h:675
void setSeed(uint32_t seed)
Setting the seed of the random number generator.
Definition Random.h:693
void randomize(T &&value)
Randomization of a given variable.
Definition Random.h:626
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition Assert.h:101
constexpr bool IsFloatingPoint_v
Auxiliary variable template for the IsFloatingPoint type trait.
Definition IsFloatingPoint.h:95
constexpr bool IsIntegral_v
Auxiliary variable template for the IsIntegral type trait.
Definition IsIntegral.h:95
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition EnableIf.h:138
Header file for the random number generator used in the Blaze library.
Header file for basic type definitions.