Counter-based random numbers: Threefry2x64-20 (Salmon, Moraes, Dror and Shaw, "Parallel random numbers: as easy as 1, 2, 3", SC'11; the Random123 library). More...
#include <Threefry.h>
Public Types | |
| using | Block = std::array<std::uint64_t,2> |
Public Member Functions | |
| Threefry2x64 (std::uint64_t key0=0, std::uint64_t key1=0) | |
| std::uint64_t | next () |
| Next 64 random bits of the stream. | |
| void | restart (std::uint64_t c0) |
| Restart the stream at the counters (c0,0), (c0,1), ... | |
| double | U01 () |
| Uniform number in the open interval (0,1), 53-bit resolution (as Random::U01) | |
Static Public Member Functions | |
| static Block | block (const Block &counter, const Block &key) |
| The Threefry2x64-20 function: one block of 128 random bits. | |
Private Attributes | |
| Block | buffer {} |
| Block | counter {} |
| Block | key |
| unsigned | used = 2 |
Counter-based random numbers: Threefry2x64-20 (Salmon, Moraes, Dror and Shaw, "Parallel random numbers: as easy as 1, 2, 3", SC'11; the Random123 library).
Each 128-bit output block is a function of a 128-bit key and a 128-bit counter only, and any keys and counters (also consecutive ones) give independent numbers. This gives reproducible numbers without storing a state, e.g. one stream per step with restart(step), as GROMACS does for replica exchange.
| using PLMD::Threefry2x64::Block = std::array<std::uint64_t,2> |
|
explicit |
|
static |
The Threefry2x64-20 function: one block of 128 random bits.
| std::uint64_t PLMD::Threefry2x64::next | ( | ) |
Next 64 random bits of the stream.
| void PLMD::Threefry2x64::restart | ( | std::uint64_t | c0 | ) |
Restart the stream at the counters (c0,0), (c0,1), ...
| double PLMD::Threefry2x64::U01 | ( | ) |
Uniform number in the open interval (0,1), 53-bit resolution (as Random::U01)
|
private |
|
private |
|
private |
|
private |
Hosted by GitHub
|
1.13.2
|