15 #ifndef __IPSDKUTIL_GENRANDOMVALUE_H__ 16 #define __IPSDKUTIL_GENRANDOMVALUE_H__ 23 #include <boost/random/mersenne_twister.hpp> 24 #include <boost/random/discrete_distribution.hpp> 25 #include <boost/random/uniform_real_distribution.hpp> 26 #include <boost/type_traits/is_integral.hpp> 44 static boost::mt19937& getGen();
46 static void resetSeed();
58 RandomUniformGenerator::setSeed(seed);
63 RandomUniformGenerator::resetSeed();
70 template <
typename T,
typename Enable=
void>
77 typename
boost::enable_if_c<boost::is_integral<T>::value>::type>
79 static IPSDK_FORCEINLINE T act(
const T& minVal,
const T& maxVal)
81 boost::random::uniform_int_distribution<T> dist(minVal, maxVal);
82 return dist(RandomUniformGenerator::getGen());
85 static IPSDK_FORCEINLINE T act()
93 typename
boost::enable_if_c<!boost::is_integral<T>::value>::type>
95 static IPSDK_FORCEINLINE T act(
const T& minVal,
const T& maxVal)
101 boost::random::uniform_real_distribution<T> dist(minVal/2, maxVal/2);
102 return dist(RandomUniformGenerator::getGen());
105 boost::random::uniform_real_distribution<T> dist(minVal, maxVal);
106 return dist(RandomUniformGenerator::getGen());
110 static IPSDK_FORCEINLINE T act()
136 #endif // __IPSDKUTIL_GENRANDOMVALUE_H__ Defines the IPSDK_FORCEINLINE.
IPSDK_FORCEINLINE T genRandomUniformValue(const T &minVal, const T &maxVal)
generates a random value of type T on the range [minVal, maxVal]
Definition: GenRandomValue.h:118
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
Definition: NumericLimits.h:27
Definition: DataItemNodeHdrMacrosDetails.h:48
Base types for multiplatform compatibility.
#define IPSDKUTIL_API
Import/Export macro for library IPSDKUtil.
Definition: IPSDKUtilExports.h:27
Definition of import/export macro for library.
class setting in its constructor the seed of the random number generator used by the implementation o...
Definition: GenRandomValue.h:55
class exposing the random number generator used by the implementation of the functions genRandomUnifo...
Definition: GenRandomValue.h:39
struct used by the implementation of the functions genRandomUniformValue
Definition: GenRandomValue.h:71
uint32_t ipUInt32
Base types definition.
Definition: BaseTypes.h:53