43 for (
int i = 0; i < key.size(); ++i) {
48 init(19650218UL, key);
64 std::ifstream in_file(filename.c_str());
71 for (
int i = 0; i <
N; ++i) {
103 std::ofstream out_file(filename.c_str());
110 for (
int i = 0; i <
N; ++i) {
111 out_file <<
m_state[i] << std::endl;
114 out_file <<
m_left << std::endl;
125 for (
int j = 1; j <
N; ++j) {
137 int key_length = key.size();
139 for (
int k =
N > key_length ?
N : key_length; k; --k) {
152 if (j >= key_length) j = 0;
155 for (
int k =
N - 1; k; --k) {
177 for (
int j =
N -
M + 1; --j; ++p) {
178 *p = p[
M] ^
twist(p[0], p[1]);
180 for (
int j =
M; --j; ++p) {
181 *p = p[
M -
N] ^
twist(p[0], p[1]);
192 const unsigned long mtrx_a = 0x9908b0dfUL;
193 const unsigned long umask = 0x80000000UL;
194 const unsigned long lmask = 0x7fffffffUL;
196 unsigned long maxbits = (u & umask) | (v & lmask);
198 return (maxbits >> 1) ^ (v & 1UL ? mtrx_a : 0UL);
207 unsigned long y = *
m_next++;
211 y ^= (y << 7) & 0x9d2c5680UL;
212 y ^= (y << 15) & 0xefc60000UL;
229 static const double factor = 1.0 / 4294967295.0;
231 return static_cast<double>(
randInt32() * factor);
238 static const double factor = 1.0 / 4294967296.0;
240 return static_cast<double>(
randInt32() * factor);
247 static const double factor = 1.0 / 4294967296.0;
249 return static_cast<double>((
randInt32() + 0.5) * factor);
258 static const double factor = 1.0 / 9007199254740992.0;
260 return (a * 67108864.0 + b) * factor;
void writefile(const std::string &)
void detailed(const char *format,...)
static const std::string class_name
void general(const char *format,...)
unsigned long twist(unsigned long u, unsigned long v) const
double randDouble1() const
void readfile(const std::string &)
double randDouble3() const
static int broadcast(size_t size, void *data, int sender)
Bridge::VerboseLevel m_vl
void init(unsigned long s)
RandomNumbers_MT19937(int s)
unsigned long randInt32() const
void crucial(const char *format,...)
double randDouble2() const
static bool is_primary()
check if the present node is primary in small communicator.