35 #ifndef _BLAZE_UTIL_RANDOM_H_ 36 #define _BLAZE_UTIL_RANDOM_H_ 130 template<
typename T >
133 template<
typename T,
typename... Args >
134 inline T
rand( Args&&... args );
136 template<
typename T >
139 template<
typename T,
typename... Args >
140 inline void randomize( T&& value, Args&&... args );
144 inline void setSeed( uint32_t seed );
169 template<
typename Type >
184 template<
typename T >
friend class Rand;
220 template<
typename T >
227 inline T generate()
const;
228 inline T generate( T
min, T
max )
const;
236 inline void randomize( T& value, T min, T max )
const;
251 template<
typename T >
272 template<
typename T >
276 std::uniform_int_distribution<T> dist( min, max );
291 template<
typename T >
312 template<
typename T >
315 value = generate( min, max );
343 inline float generate()
const;
344 inline float generate(
float min,
float max )
const;
351 inline void randomize(
float& value )
const;
352 inline void randomize(
float& value,
float min,
float max )
const;
370 std::uniform_real_distribution<float> dist( 0.0, 1.0 );
393 std::uniform_real_distribution<float> dist( min, max );
433 value = generate( min, max );
462 inline double generate()
const;
463 inline double generate(
double min,
double max )
const;
470 inline void randomize(
double& value )
const;
471 inline void randomize(
double& value,
double min,
double max )
const;
489 std::uniform_real_distribution<double> dist( 0.0, 1.0 );
512 std::uniform_real_distribution<double> dist( min, max );
552 value = generate( min, max );
575 class Rand<long double>
581 inline long double generate()
const;
582 inline long double generate(
long double min,
long double max )
const;
589 inline void randomize(
long double& value )
const;
590 inline void randomize(
long double& value,
long double min,
long double max )
const;
608 std::uniform_real_distribution<long double> dist( 0.0, 1.0 );
631 std::uniform_real_distribution<long double> dist( min, max );
671 value = generate( min, max );
692 template<
typename T >
693 class Rand< complex<T> >
699 inline const complex<T> generate()
const;
700 inline const complex<T> generate(
const T& min,
const T& max )
const;
701 inline const complex<T> generate(
const T& realmin,
const T& realmax,
702 const T& imagmin,
const T& imagmax )
const;
709 inline void randomize( complex<T>& value )
const;
710 inline void randomize( complex<T>& value,
const T& min,
const T& max )
const;
711 inline void randomize( complex<T>& value,
const T& realmin,
const T& realmax,
712 const T& imagmin,
const T& imagmax )
const;
729 template<
typename T >
753 template<
typename T >
754 inline const complex<T>
Rand< complex<T> >::generate(
const T& min,
const T& max )
const 780 template<
typename T >
781 inline const complex<T>
Rand< complex<T> >::generate(
const T& realmin,
const T& realmax,
782 const T& imagmin,
const T& imagmax )
const 785 return complex<T>( tmp.
generate( realmin, realmax ), tmp.
generate( imagmin, imagmax ) );
801 template<
typename T >
825 template<
typename T >
828 value = generate( min, max );
853 template<
typename T >
855 const T& imagmin,
const T& imagmax )
const 857 value = generate( realmin, realmax, imagmin, imagmax );
885 template<
typename T >
905 inline T
rand( Args&&... args )
908 return tmp.
generate( std::forward<Args>( args )... );
928 template<
typename T >
932 tmp.
randomize( std::forward<T>( value ) );
952 tmp.
randomize( std::forward<T>( value ), std::forward<Args>( args )... );
uint32_t getSeed()
Returns the current seed of the random number generator.
Definition: Random.h:977
Header file for basic type definitions.
Header file for the RemoveCV type trait.
void randomize(T &&value)
Randomization of a given variable.
Definition: Random.h:929
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1903
const ElementType_< MT > max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1950
32-bit unsigned integer type of the Blaze library.
Header file for the random number generator used in the Blaze library.
Header file for the Decay type trait.
uint32_t defaultSeed()
Returns the default random seed.
Definition: Random.h:963
void randomize(T &value) const
Randomization of the given variable with a new value in the range .
Definition: Random.h:292
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
void setSeed(uint32_t seed)
Setting the seed of the random number generator.
Definition: Random.h:994
T rand()
Random number function.
Definition: Random.h:886
Header file for run time assertion macros.
Default implementation of the Rand class for integral data types.This default implementation of the R...
Definition: Random.h:221
Random number generator.The Random class encapsulates the initialization of the given random number g...
Definition: Random.h:170
static uint32_t seed_
The current seed for the variate generator.
Definition: Random.h:177
static Type rng_
The mersenne twister variate generator.
Definition: Random.h:178
T generate() const
Generation of a random value in the range .
Definition: Random.h:252
Header file for the complex data type.
Base class for non-creatable (static) classes.The NonCreatable class is intended to work as a base cl...
Definition: NonCreatable.h:65
Base class for non-creatable (static) classes.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101