QuIDS: Quantum Irregular Dynamic Simulator
random.hpp
1#pragma once
2
3#include <cstdint>
4
6namespace quids::utils {
9 private:
10 uint64_t shuffle_table[2];
11 public:
13 shuffle_table[0] = rand();
14 shuffle_table[1] = rand();
15 }
16
17 // The actual algorithm
18 float operator()() {
19 uint64_t s1 = shuffle_table[0];
20 uint64_t s0 = shuffle_table[1];
21 uint64_t result = s0 + s1;
22 shuffle_table[0] = s0;
23 s1 ^= s1 << 23;
24 shuffle_table[1] = s1 ^ s0 ^ (s1 >> 18) ^ (s0 >> 5);
25 return (float)result / (float)((uint64_t)0xffffffff);
26 }
27 };
28}
simple random generator
Definition: random.hpp:8
QuIDS utility function and variable namespace.
Definition: algorithm.hpp:6