OpenQMC API
Loading...
Searching...
No Matches
pcg.h File Reference
#include "gpu.h"
#include <cassert>
#include <cstdint>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  oqmc
 
namespace  oqmc::pcg
 

Functions

constexpr std::uint32_t oqmc::pcg::stateTransition (std::uint32_t state)
 State transition function.
 
constexpr std::uint32_t oqmc::pcg::output (std::uint32_t state)
 Output permutation function.
 
constexpr std::uint32_t oqmc::pcg::init ()
 Default initialise the PRNG state.
 
constexpr std::uint32_t oqmc::pcg::init (std::uint32_t seed)
 Initialise the PRNG state using a seed value.
 
constexpr std::uint32_t oqmc::pcg::hash (std::uint32_t key)
 Compute a hash value based on an input key.
 
constexpr std::uint32_t oqmc::pcg::rng (std::uint32_t &state)
 Compute a random number from the PRNG sequence.
 

Detailed Description

An implementation of a pseudo random number generator (PRNG) by Melissa E. O'Neill. Specifically the insecure PCG-RXS-M-RX-32 (commonly referred to as PCG), as this meets the criteria required by higher level functionality in the library. Further details are in 'PCG: A Family of Simple Fast Space-Efficient Statistically Good Algorithms for Random Number Generation'. This is also used to construct a hash function as described in 'Hash Functions for GPU Rendering' by Mark Jarzynski and Marc Olano. The constant coefficients for the PCG-RXS-M-RX-32 implementation were taken from https://github.com/imneme/pcg-c.