42 for (
int i = 0; i < key.size(); ++i) {
47 init(19650218UL, key);
63 std::ifstream in_file(filename.c_str());
71 for (
int i = 0; i <
N; ++i) {
101 std::ofstream out_file(filename.c_str());
108 for (
int i = 0; i <
N; ++i) {
109 out_file <<
m_state[i] << std::endl;
112 out_file <<
m_left << std::endl;
123 for (
int j = 1; j <
N; ++j) {
135 int key_length = key.size();
137 for (
int k =
N > key_length ?
N : key_length; k; --k) {
150 if (j >= key_length) j = 0;
153 for (
int k =
N - 1; k; --k) {
175 for (
int j =
N -
M + 1; --j; ++p) {
176 *p = p[
M] ^
twist(p[0], p[1]);
178 for (
int j =
M; --j; ++p) {
179 *p = p[
M -
N] ^
twist(p[0], p[1]);
190 const unsigned long mtrx_a = 0x9908b0dfUL;
191 const unsigned long umask = 0x80000000UL;
192 const unsigned long lmask = 0x7fffffffUL;
194 unsigned long maxbits = (u & umask) | (v & lmask);
196 return (maxbits >> 1) ^ (v & 1UL ? mtrx_a : 0UL);
205 unsigned long y = *
m_next++;
209 y ^= (y << 7) & 0x9d2c5680UL;
210 y ^= (y << 15) & 0xefc60000UL;
227 static const double factor = 1.0 / 4294967295.0;
229 return static_cast<double>(
randInt32() * factor);
236 static const double factor = 1.0 / 4294967296.0;
238 return static_cast<double>(
randInt32() * factor);
245 static const double factor = 1.0 / 4294967296.0;
247 return static_cast<double>((
randInt32() + 0.5) * factor);
256 static const double factor = 1.0 / 9007199254740992.0;
259 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.