ROOT-Sim core
3.0.0-rc.2
A General-Purpose Multi-threaded Parallel/Distributed Simulation Library
src
lib
random
xoroshiro.h
Go to the documentation of this file.
1
11
#pragma once
12
13
#include <stdint.h>
14
15
#define rotl(x, k) (((x) << (k)) | ((x) >> (64 - (k))))
16
17
#define random_u64(rng_s) \
18
__extension__({ \
19
const uint64_t __res = rotl((rng_s)[1] * 5, 7) * 9; \
20
const uint64_t __t = (rng_s)[1] << 17; \
21
\
22
(rng_s)[2] ^= (rng_s)[0]; \
23
(rng_s)[3] ^= (rng_s)[1]; \
24
(rng_s)[1] ^= (rng_s)[2]; \
25
(rng_s)[0] ^= (rng_s)[3]; \
26
(rng_s)[2] ^= __t; \
27
(rng_s)[3] = rotl((rng_s)[3], 45); \
28
\
29
__res; \
30
})
31
Generated by
1.9.1