35 #ifndef _BLAZE_UTIL_RANDOM_H_ 36 #define _BLAZE_UTIL_RANDOM_H_ 128 template<
typename T >
131 template<
typename T,
typename... Args >
132 inline T
rand( Args&&... args );
134 template<
typename T >
137 template<
typename T,
typename... Args >
138 inline void randomize( T& value, Args&&... args );
142 inline void setSeed( uint32_t seed );
167 template<
typename Type >
182 template<
typename T >
friend class Rand;
218 template<
typename T >
225 inline T generate()
const;
226 inline T generate( T
min, T
max )
const;
234 inline void randomize( T& value, T min, T max )
const;
249 template<
typename T >
270 template<
typename T >
274 std::uniform_int_distribution<T> dist( min, max );
289 template<
typename T >
310 template<
typename T >
313 value = generate( min, max );
341 inline float generate()
const;
342 inline float generate(
float min,
float max )
const;
349 inline void randomize(
float& value )
const;
350 inline void randomize(
float& value,
float min,
float max )
const;
368 std::uniform_real_distribution<float> dist( 0.0, 1.0 );
391 std::uniform_real_distribution<float> dist( min, max );
431 value = generate( min, max );
460 inline double generate()
const;
461 inline double generate(
double min,
double max )
const;
468 inline void randomize(
double& value )
const;
469 inline void randomize(
double& value,
double min,
double max )
const;
487 std::uniform_real_distribution<double> dist( 0.0, 1.0 );
510 std::uniform_real_distribution<double> dist( min, max );
550 value = generate( min, max );
573 class Rand<long double>
579 inline long double generate()
const;
580 inline long double generate(
long double min,
long double max )
const;
587 inline void randomize(
long double& value )
const;
588 inline void randomize(
long double& value,
long double min,
long double max )
const;
606 std::uniform_real_distribution<long double> dist( 0.0, 1.0 );
629 std::uniform_real_distribution<long double> dist( min, max );
669 value = generate( min, max );
690 template<
typename T >
691 class Rand< complex<T> >
697 inline const complex<T> generate()
const;
698 inline const complex<T> generate(
const T& min,
const T& max )
const;
699 inline const complex<T> generate(
const T& realmin,
const T& realmax,
700 const T& imagmin,
const T& imagmax )
const;
707 inline void randomize( complex<T>& value )
const;
708 inline void randomize( complex<T>& value,
const T& min,
const T& max )
const;
709 inline void randomize( complex<T>& value,
const T& realmin,
const T& realmax,
710 const T& imagmin,
const T& imagmax )
const;
727 template<
typename T >
751 template<
typename T >
752 inline const complex<T>
Rand< complex<T> >::generate(
const T& min,
const T& max )
const 778 template<
typename T >
779 inline const complex<T>
Rand< complex<T> >::generate(
const T& realmin,
const T& realmax,
780 const T& imagmin,
const T& imagmax )
const 783 return complex<T>( tmp.
generate( realmin, realmax ), tmp.
generate( imagmin, imagmax ) );
799 template<
typename T >
823 template<
typename T >
826 value = generate( min, max );
851 template<
typename T >
853 const T& imagmin,
const T& imagmax )
const 855 value = generate( realmin, realmax, imagmin, imagmax );
883 template<
typename T >
903 inline T
rand( Args&&... args )
906 return tmp.
generate( std::forward<Args>( args )... );
926 template<
typename T >
950 tmp.
randomize( value, std::forward<Args>( args )... );
uint32_t getSeed()
Returns the current seed of the random number generator.
Definition: Random.h:975
Header file for basic type definitions.
void randomize(T &value)
Randomization of a given variable.
Definition: Random.h:927
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1762
const ElementType_< MT > max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1809
32-bit unsigned integer type of the Blaze library.
Header file for the random number generator used in the Blaze library.
uint32_t defaultSeed()
Returns the default random seed.
Definition: Random.h:961
void randomize(T &value) const
Randomization of the given variable with a new value in the range .
Definition: Random.h:290
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
void setSeed(uint32_t seed)
Setting the seed of the random number generator.
Definition: Random.h:992
T rand()
Random number function.
Definition: Random.h:884
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:219
Random number generator.The Random class encapsulates the initialization of the given random number g...
Definition: Random.h:168
static uint32_t seed_
The current seed for the variate generator.
Definition: Random.h:175
static Type rng_
The mersenne twister variate generator.
Definition: Random.h:176
T generate() const
Generation of a random value in the range .
Definition: Random.h:250
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