7 #ifndef SIMPLE_RANDOM_H
8 #define SIMPLE_RANDOM_H
28 template <
typename Scalar =
double>
35 const unsigned int m_a;
36 const unsigned long m_max;
39 inline long next_long_rand(
long seed)
43 lo = m_a * (long) (seed & 0xFFFF);
44 hi = m_a * (long) ((
unsigned long) seed >> 16);
45 lo += (hi & 0x7FFF) << 16;
61 SimpleRandom(
unsigned long init_seed) :
64 m_rand(init_seed ? (init_seed & m_max) : 1)
69 m_rand = next_long_rand(m_rand);
80 m_rand = next_long_rand(m_rand);
91 #endif // SIMPLE_RANDOM_H