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);
75 Vector random_vec(
const Index
len)
78 for (Index
i = 0;
i <
len;
i++)
80 m_rand = next_long_rand(m_rand);
91 #endif // SIMPLE_RANDOM_H
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
const mpreal random(unsigned int seed=0)
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector