12 #ifndef ECL_TIME_RANDOM_NUMBER_GENERATOR_HPP_ 13 #define ECL_TIME_RANDOM_NUMBER_GENERATOR_HPP_ 24 #if defined(ECL_IS_WIN32) 56 return (
uniform()-0.5)*2.0*range;
61 return static_cast<T
>(rand())/static_cast<T>(RAND_MAX);
68 static bool use_last =
false;
80 w = x1 * x1 + x2 * x2;
83 w = std::sqrt( (-2.0 * std::log( w ) ) / w );
113 unsigned long a = clock();
114 unsigned long b = ::time(NULL);
115 unsigned long c = getpid();
116 a=a-b; a=a-c; a=a^(c >> 13);
117 b=b-c; b=b-a; b=b^(a << 8);
118 c=c-a; c=c-b; c=c^(b >> 13);
119 a=a-b; a=a-c; a=a^(c >> 12);
120 b=b-c; b=b-a; b=b^(a << 16);
121 c=c-a; c=c-b; c=c^(b >> 5);
122 a=a-b; a=a-c; a=a^(c >> 3);
123 b=b-c; b=b-a; b=b^(a << 10);
124 c=c-a; c=c-b; c=c^(b >> 15);
Embedded control libraries.
A random number generator.
T uniform(const T &range)
T gaussian(const T &std, const T &mu=0)
RandomNumberGenerator(const unsigned int randSeed)
static void seed()
Seed the system random number generator.