This commit is contained in:
2023-02-11 12:19:05 +06:00
parent 609dfcf3ed
commit 305854e721
77 changed files with 565 additions and 562 deletions

View File

@@ -13,20 +13,20 @@ See <http://creativecommons.org/publicdomain/zero/1.0/>. */
enough for any parallel application, and it passes all tests we are
aware of.
For generating just floating-point numbers, xoshiro256+ is even faster.
For generating just floating-poi32 numbers, xoshiro256+ is even faster.
The state must be seeded so that it is not everywhere zero. If you have
a 64-bit seed, we suggest to seed a splitmix64 generator and use its
output to fill s. */
static inline uint64 rotl(const uint64 x, int k) {
static inline u64 rotl(const u64 x, i32 k) {
return (x << k) | (x>>(64 - k));
}
uint64 xoshiro256plusplus_next(void* _state) {
u64 xoshiro256plusplus_next(void* _state) {
xoshiro256_state* state=_state;
const uint64 result=rotl(state->s[0] + state->s[3], 23) + state->s[0];
const uint64 t=state->s[1] << 17;
const u64 result=rotl(state->s[0] + state->s[3], 23) + state->s[0];
const u64 t=state->s[1] << 17;
state->s[2] ^= state->s[0];
state->s[3] ^= state->s[1];
state->s[1] ^= state->s[2];