diff options
author | Vladimir Azarov <avm@intermediate-node.net> | 2024-10-01 15:47:05 +0200 |
---|---|---|
committer | Vladimir Azarov <avm@intermediate-node.net> | 2024-10-01 15:47:05 +0200 |
commit | 4abab5ad6c8465a7528ccdd5f49367da05f78bbd (patch) | |
tree | ebf009bf1376a5a223a915bc27cbbd791a1316bc /src/prng/__rand48_step.c |
Initial version
Diffstat (limited to 'src/prng/__rand48_step.c')
-rw-r--r-- | src/prng/__rand48_step.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/prng/__rand48_step.c b/src/prng/__rand48_step.c new file mode 100644 index 0000000..94703d0 --- /dev/null +++ b/src/prng/__rand48_step.c @@ -0,0 +1,14 @@ +#include <stdint.h> +#include "rand48.h" + +uint64_t __rand48_step(unsigned short *xi, unsigned short *lc) +{ + uint64_t a, x; + x = xi[0] | xi[1]+0U<<16 | xi[2]+0ULL<<32; + a = lc[0] | lc[1]+0U<<16 | lc[2]+0ULL<<32; + x = a*x + lc[3]; + xi[0] = x; + xi[1] = x>>16; + xi[2] = x>>32; + return x & 0xffffffffffffull; +} |