kerep-headers
This commit is contained in:
40
kerep-headers/random/xoshiro/32bitValue/xoshiro128.h
Normal file
40
kerep-headers/random/xoshiro/32bitValue/xoshiro128.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "../../../base/std.h"
|
||||
#include "../../splitmix64/splitmix64.h"
|
||||
|
||||
|
||||
typedef union {
|
||||
u64 merged[2];
|
||||
u32 s[4];
|
||||
} xoshiro128_state;
|
||||
typedef void* xoshiro128_statePtr;
|
||||
|
||||
xoshiro128_statePtr xoshiro128_init(u64 seed);
|
||||
#define xoshiro128plus_init xoshiro128_init
|
||||
#define xoshiro128plusplus_init xoshiro128_init
|
||||
#define xoshiro128starstar_init xoshiro128_init
|
||||
|
||||
static inline xoshiro128_statePtr xoshiro128_initFromTime(void) { return xoshiro128_init(time(NULL)); }
|
||||
#define xoshiro128plus_initFromTime xoshiro128_initFromTime
|
||||
#define xoshiro128plusplus_initFromTime xoshiro128_initFromTime
|
||||
#define xoshiro128starstar_initFromTime xoshiro128_initFromTime
|
||||
|
||||
u32 xoshiro128plus_next(xoshiro128_statePtr);
|
||||
u32 xoshiro128plusplus_next(xoshiro128_statePtr);
|
||||
u32 xoshiro128starstar_next(xoshiro128_statePtr);
|
||||
|
||||
static inline void xoshiro128_free(xoshiro128_statePtr state) {
|
||||
free(state);
|
||||
}
|
||||
#define xoshiro128plus_free xoshiro128_free
|
||||
#define xoshiro128plusplus_free xoshiro128_free
|
||||
#define xoshiro128starstar_free xoshiro128_free
|
||||
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
39
kerep-headers/random/xoshiro/64bitValue/xoshiro256.h
Normal file
39
kerep-headers/random/xoshiro/64bitValue/xoshiro256.h
Normal file
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "../../../base/std.h"
|
||||
#include "../../splitmix64/splitmix64.h"
|
||||
|
||||
|
||||
typedef union {
|
||||
u64 s[4];
|
||||
} xoshiro256_state;
|
||||
typedef void* xoshiro256_statePtr;
|
||||
|
||||
xoshiro256_statePtr xoshiro256_init(u64 seed);
|
||||
#define xoshiro256plus_init xoshiro256_init
|
||||
#define xoshiro256plusplus_init xoshiro256_init
|
||||
#define xoshiro256starstar_init xoshiro256_init
|
||||
|
||||
static inline xoshiro256_statePtr xoshiro256_initFromTime(void) { return xoshiro256_init(time(NULL)); }
|
||||
#define xoshiro256plus_initFromTime xoshiro256_initFromTime
|
||||
#define xoshiro256plusplus_initFromTime xoshiro256_initFromTime
|
||||
#define xoshiro256starstar_initFromTime xoshiro256_initFromTime
|
||||
|
||||
u64 xoshiro256plus_next(xoshiro256_statePtr);
|
||||
u64 xoshiro256plusplus_next(xoshiro256_statePtr);
|
||||
u64 xoshiro256starstar_next(xoshiro256_statePtr);
|
||||
|
||||
static inline void xoshiro256_free(xoshiro256_statePtr state) {
|
||||
free(state);
|
||||
}
|
||||
#define xoshiro256plus_free xoshiro256_free
|
||||
#define xoshiro256plusplus_free xoshiro256_free
|
||||
#define xoshiro256starstar_free xoshiro256_free
|
||||
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
2
kerep-headers/random/xoshiro/xoshiro.h
Normal file
2
kerep-headers/random/xoshiro/xoshiro.h
Normal file
@@ -0,0 +1,2 @@
|
||||
#include "32bitValue/xoshiro128.h"
|
||||
#include "64bitValue/xoshiro256.h"
|
||||
Reference in New Issue
Block a user