- the fourth.

This commit is contained in:
Christoph Oelckers 2017-03-08 18:47:52 +01:00
commit 8ab562ef13
107 changed files with 1041 additions and 1041 deletions

View file

@ -86,21 +86,21 @@ public:
return operator()();
}
void Init(DWORD seed);
void Init(uint32_t seed);
// SFMT interface
unsigned int GenRand32();
QWORD GenRand64();
void FillArray32(DWORD *array, int size);
void FillArray32(uint32_t *array, int size);
void FillArray64(QWORD *array, int size);
void InitGenRand(DWORD seed);
void InitByArray(DWORD *init_key, int key_length);
void InitGenRand(uint32_t seed);
void InitByArray(uint32_t *init_key, int key_length);
int GetMinArraySize32();
int GetMinArraySize64();
/* These real versions are due to Isaku Wada */
/** generates a random number on [0,1]-real-interval */
static inline double ToReal1(DWORD v)
static inline double ToReal1(uint32_t v)
{
return v * (1.0/4294967295.0);
/* divided by 2^32-1 */
@ -113,7 +113,7 @@ public:
}
/** generates a random number on [0,1)-real-interval */
static inline double ToReal2(DWORD v)
static inline double ToReal2(uint32_t v)
{
return v * (1.0/4294967296.0);
/* divided by 2^32 */
@ -126,7 +126,7 @@ public:
}
/** generates a random number on (0,1)-real-interval */
static inline double ToReal3(DWORD v)
static inline double ToReal3(uint32_t v)
{
return (((double)v) + 0.5)*(1.0/4294967296.0);
/* divided by 2^32 */
@ -147,7 +147,7 @@ public:
/** generates a random number on [0,1) with 53-bit resolution from two
* 32 bit integers */
static inline double ToRes53Mix(DWORD x, DWORD y)
static inline double ToRes53Mix(uint32_t x, uint32_t y)
{
return ToRes53(x | ((QWORD)y << 32));
}
@ -164,7 +164,7 @@ public:
*/
inline double GenRand_Res53_Mix()
{
DWORD x, y;
uint32_t x, y;
x = GenRand32();
y = GenRand32();
@ -173,7 +173,7 @@ public:
// Static interface
static void StaticClearRandom ();
static DWORD StaticSumSeeds ();
static uint32_t StaticSumSeeds ();
static void StaticReadRNGState (FSerializer &arc);
static void StaticWriteRNGState (FSerializer &file);
static FRandom *StaticFindRNG(const char *name);
@ -187,7 +187,7 @@ private:
const char *Name;
#endif
FRandom *Next;
DWORD NameCRC;
uint32_t NameCRC;
static FRandom *RNGList;
@ -215,9 +215,9 @@ private:
#endif
};
extern DWORD rngseed; // The starting seed (not part of state)
extern uint32_t rngseed; // The starting seed (not part of state)
extern DWORD staticrngseed; // Static rngseed that can be set by the user
extern uint32_t staticrngseed; // Static rngseed that can be set by the user
extern bool use_staticrng;