51 static const int N = 17;
65 double flat() {
return (S.counter<=(N-1)) ? generate(S.counter):iterate(); }
70 void flatArray (
const int size,
double* vect);
73 void setSeed(
long seed,
int dum=0);
76 void setSeeds(
const long * seeds,
int seedNum=0);
82 void saveStatus(
const char filename[] =
"MixMaxRngState.conf" )
const;
85 void restoreStatus(
const char filename[] =
"MixMaxRngState.conf" );
96 operator unsigned int();
99 virtual std::ostream &
put (std::ostream & os)
const;
100 virtual std::istream &
get (std::istream & is);
102 virtual std::istream &
getState ( std::istream & is );
104 std::string
name()
const {
return "MixMaxRng"; }
107 std::vector<unsigned long>
put ()
const;
108 bool get (
const std::vector<unsigned long> & v);
109 bool getState (
const std::vector<unsigned long> & v);
113 static constexpr long long int SPECIAL = ((N==17)? 0 : ((N==240)? 487013230256099140ULL:0) );
114 static constexpr long long int SPECIALMUL= ((N==17)? 36: ((N==240)? 51 :53) );
116 static constexpr int BITS=61;
117 static constexpr myuint_t M61=2305843009213693951ULL;
118 static constexpr double INV_M61=0.43368086899420177360298E-18;
119 static constexpr unsigned int VECTOR_STATE_SIZE = 2*N+4;
121 #define MIXMAX_MOD_MERSENNE(k) ((((k)) & M61) + (((k)) >> BITS) )
123 static constexpr int rng_get_N();
124 static constexpr long long int rng_get_SPECIAL();
125 static constexpr int rng_get_SPECIALMUL();
128 void print_state()
const;
131 inline double get_next_float() {
return get_next_float_packbits(); }
135 void BranchInplace(
int id);
138 inline void seed64(
myuint_t seedval) { seed_uniquestream( 0, 0, (
myID_t)(seedval>>32), (
myID_t)seedval ); }
140 double generate(
int i);
143 double get_next_float_packbits();
145#pragma GCC diagnostic push
146#pragma GCC diagnostic ignored "-Wstrict-aliasing"
148 inline double convert1double(
myuint_t u)
150 const double one = 1;
153 double d = *(
double*)&tmp;
157#pragma GCC diagnostic pop
161 void seed_vielbein(
unsigned int i);
165#if defined(__x86_64__)
176 std::array<myuint_t, N> V;
181 typedef struct rng_state_st rng_state_t;
void restoreStatus(const char filename[]="MixMaxRngState.conf")
void flatArray(const int size, double *vect)
void setSeed(long seed, int dum=0)
static std::string beginTag()
void saveStatus(const char filename[]="MixMaxRngState.conf") const
virtual std::istream & get(std::istream &is)
MixMaxRng & operator=(const MixMaxRng &rng)
virtual std::istream & getState(std::istream &is)
std::vector< unsigned long > put() const
void setSeeds(const long *seeds, int seedNum=0)
static std::string engineName()
unsigned long long int myuint_t