52 static const int N = 17;
66 double flat() {
return (S.counter<=(
N-1)) ? generate(S.counter):iterate(); }
71 void flatArray (
const int size,
double* vect);
74 void setSeed(
long seed,
int dum=0);
77 void setSeeds(
const long * seeds,
int seedNum=0);
83 void saveStatus(
const char filename[] =
"MixMaxRngState.conf" )
const;
86 void restoreStatus(
const char filename[] =
"MixMaxRngState.conf" );
97 operator unsigned int();
100 virtual std::ostream &
put (std::ostream & os)
const;
101 virtual std::istream &
get (std::istream & is);
103 virtual std::istream &
getState ( std::istream & is );
105 std::string
name()
const {
return "MixMaxRng"; }
108 std::vector<unsigned long>
put ()
const;
109 bool get (
const std::vector<unsigned long> & v);
110 bool getState (
const std::vector<unsigned long> & v);
114 static constexpr long long int SPECIAL = ((
N==17)? 0 : ((N==240)? 487013230256099140ULL:0) );
115 static constexpr long long int SPECIALMUL= ((
N==17)? 36: ((N==240)? 51 :53) );
117 static constexpr int BITS=61;
118 static constexpr myuint_t M61=2305843009213693951ULL;
119 static constexpr double INV_M61=0.43368086899420177360298E-18;
120 static constexpr unsigned int VECTOR_STATE_SIZE = 2*
N+4;
122 #define MIXMAX_MOD_MERSENNE(k) ((((k)) & M61) + (((k)) >> BITS) )
124 static constexpr int rng_get_N();
125 static constexpr long long int rng_get_SPECIAL();
126 static constexpr int rng_get_SPECIALMUL();
129 void print_state()
const;
132 inline double get_next_float() {
return get_next_float_packbits(); }
136 void BranchInplace(
int id);
139 inline void seed64(
myuint_t seedval) { seed_uniquestream( 0, 0, (
myID_t)(seedval>>32), (
myID_t)seedval ); }
141 double generate(
int i);
144 double get_next_float_packbits();
146#pragma GCC diagnostic push
147#pragma GCC diagnostic ignored "-Wstrict-aliasing"
148#pragma GCC diagnostic ignored "-Wuninitialized"
150 inline double convert1double(
myuint_t u)
152 const double one = 1;
155 double d = *(
double*)&tmp;
159#pragma GCC diagnostic pop
163 void seed_vielbein(
unsigned int i);
167#if defined(__x86_64__)
178 std::array<myuint_t, N> V;
183 typedef struct rng_state_st rng_state_t;
G4double S(G4double temp)
G4double Y(G4double density)
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