kerep-headers
This commit is contained in:
35
kerep-headers/random/xoroshiro/32bitValue/xoroshiro64.h
Normal file
35
kerep-headers/random/xoroshiro/32bitValue/xoroshiro64.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "../../../base/std.h"
|
||||
#include "../../splitmix64/splitmix64.h"
|
||||
|
||||
typedef union {
|
||||
u64 merged;
|
||||
u32 s[2];
|
||||
} xoroshiro64_state;
|
||||
typedef void* xoroshiro64_statePtr;
|
||||
|
||||
xoroshiro64_statePtr xoroshiro64_init(u64 seed);
|
||||
#define xoroshiro64star_init xoroshiro64_init
|
||||
#define xoroshiro64starstar_init xoroshiro64_init
|
||||
|
||||
static inline xoroshiro64_statePtr xoroshiro64_initFromTime(void) { return xoroshiro64_init(time(NULL)); }
|
||||
#define xoroshiro64star_initFromTime xoroshiro64_initFromTime
|
||||
#define xoroshiro64starstar_initFromTime xoroshiro64_initFromTime
|
||||
|
||||
u32 xoroshiro64star_next(xoroshiro64_statePtr);
|
||||
u32 xoroshiro64starstar_next(xoroshiro64_statePtr);
|
||||
|
||||
static inline void xoroshiro64_free(xoroshiro64_statePtr state) {
|
||||
free(state);
|
||||
}
|
||||
#define xoroshiro64star_free xoroshiro64_free
|
||||
#define xoroshiro64starstar_free xoroshiro64_free
|
||||
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
39
kerep-headers/random/xoroshiro/64bitValue/xoroshiro128.h
Normal file
39
kerep-headers/random/xoroshiro/64bitValue/xoroshiro128.h
Normal file
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "../../../base/std.h"
|
||||
#include "../../splitmix64/splitmix64.h"
|
||||
|
||||
|
||||
typedef union {
|
||||
u32 s[2];
|
||||
} xoroshiro128_state;
|
||||
typedef void* xoroshiro128_statePtr;
|
||||
|
||||
xoroshiro128_statePtr xoroshiro128_init(u64 seed);
|
||||
#define xoroshiro128plus_init xoroshiro128_init
|
||||
#define xoroshiro128plusplus_init xoroshiro128_init
|
||||
#define xoroshiro128starstar_init xoroshiro128_init
|
||||
|
||||
static inline xoroshiro128_statePtr xoroshiro128_initFromTime(void) { return xoroshiro128_init(time(NULL)); }
|
||||
#define xoroshiro128plus_initFromTime xoroshiro128_initFromTime
|
||||
#define xoroshiro128plusplus_initFromTime xoroshiro128_initFromTime
|
||||
#define xoroshiro128starstar_initFromTime xoroshiro128_initFromTime
|
||||
|
||||
u64 xoroshiro128plus_next(xoroshiro128_statePtr);
|
||||
u64 xoroshiro128plusplus_next(xoroshiro128_statePtr);
|
||||
u64 xoroshiro128starstar_next(xoroshiro128_statePtr);
|
||||
|
||||
static inline void xoroshiro128_free(xoroshiro128_statePtr state) {
|
||||
free(state);
|
||||
}
|
||||
#define xoroshiro128plus_free xoroshiro128_free
|
||||
#define xoroshiro128plusplus_free xoroshiro128_free
|
||||
#define xoroshiro128starstar_free xoroshiro128_free
|
||||
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
2
kerep-headers/random/xoroshiro/xoroshiro.h
Normal file
2
kerep-headers/random/xoroshiro/xoroshiro.h
Normal file
@@ -0,0 +1,2 @@
|
||||
#include "32bitValue/xoroshiro64.h"
|
||||
#include "64bitValue/xoroshiro128.h"
|
||||
Reference in New Issue
Block a user