38#include "CLHEP/Random/defs.h"
39#include "CLHEP/Random/RandomEngine.h"
53 static const int N = 17;
67 double flat() {
return (S.counter<=(N-1)) ? generate(S.counter):iterate(); }
72 void flatArray (
const int size,
double* vect);
75 void setSeed(
long seed,
int dum=0);
78 void setSeeds(
const long * seeds,
int seedNum=0);
84 void saveStatus(
const char filename[] =
"MixMaxRngState.conf" )
const;
87 void restoreStatus(
const char filename[] =
"MixMaxRngState.conf" );
98 operator unsigned int();
101 virtual std::ostream &
put (std::ostream & os)
const;
102 virtual std::istream &
get (std::istream & is);
104 virtual std::istream &
getState ( std::istream & is );
106 std::string
name()
const {
return "MixMaxRng"; }
109 std::vector<unsigned long>
put ()
const;
110 bool get (
const std::vector<unsigned long> & v);
111 bool getState (
const std::vector<unsigned long> & v);
115 static constexpr long long int SPECIAL = ((N==17)? 0 : ((N==240)? 487013230256099140ULL:0) );
116 static constexpr long long int SPECIALMUL= ((N==17)? 36: ((N==240)? 51 :53) );
118 static constexpr int BITS=61;
119 static constexpr myuint_t M61=2305843009213693951ULL;
120 static constexpr double INV_M61=0.43368086899420177360298E-18;
121 static constexpr unsigned int VECTOR_STATE_SIZE = 2*N+4;
123 #define MIXMAX_MOD_MERSENNE(k) ((((k)) & M61) + (((k)) >> BITS) )
125 static constexpr int rng_get_N();
126 static constexpr long long int rng_get_SPECIAL();
127 static constexpr int rng_get_SPECIALMUL();
130 void print_state()
const;
133 inline double get_next_float() {
return get_next_float_packbits(); }
137 void BranchInplace(
int id);
140 inline void seed64(
myuint_t seedval) { seed_uniquestream( 0, 0, (
myID_t)(seedval>>32), (
myID_t)seedval ); }
142 double generate(
int i);
145 double get_next_float_packbits();
147#pragma GCC diagnostic push
148#pragma GCC diagnostic ignored "-Wstrict-aliasing"
149#pragma GCC diagnostic ignored "-Wuninitialized"
151 inline double convert1double(
myuint_t u)
153 const double one = 1;
156 double d = *(
double*)&tmp;
160#pragma GCC diagnostic pop
164 void seed_vielbein(
unsigned int i);
168#if defined(__x86_64__)
179 std::array<myuint_t, N> V;
184 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