OpenRAND  0.9
OpenRAND: A C++ Library for Reproducible Random Number Generation in Parallel Computing Environments
Public Member Functions | Public Attributes | List of all members
openrand::Philox Class Reference

Philox generator. More...

#include <philox.h>

Inheritance diagram for openrand::Philox:
openrand::BaseRNG< Philox >

Public Member Functions

OPENRAND_DEVICE Philox (uint64_t seed, uint32_t ctr, uint32_t global_seed=openrand::DEFAULT_GLOBAL_SEED, uint32_t ctr1=0x12345)
 Construct a new Philox generator. More...
 
template<typename T = uint32_t>
OPENRAND_DEVICE T draw ()
 
openrand::uint4 draw_int4 ()
 
openrand::float4 draw_float4 ()
 
- Public Member Functions inherited from openrand::BaseRNG< Philox >
OPENRAND_DEVICE result_type operator() ()
 Generates a 32 bit unsigned integer from a uniform distribution. More...
 
OPENRAND_DEVICE T rand ()
 Generates a random number from a uniform distribution between 0 and 1. More...
 
OPENRAND_DEVICE T uniform (const T low, const T high)
 Generates a number from a uniform distribution between a and b. More...
 
OPENRAND_DEVICE void fill_random (T *array, const int N)
 
OPENRAND_DEVICE T randn ()
 Generates a random number from a normal distribution with mean 0 and std 1. More...
 
OPENRAND_DEVICE T randn (const T mean, const T std_dev)
 Generates a random number from a normal distribution with mean and std. More...
 
OPENRAND_DEVICE vec2< T > randn2 ()
 More efficient version of randn, returns two values at once. More...
 
OPENRAND_DEVICE T range (const T N)
 Generates a random integer of certain range. More...
 
OPENRAND_DEVICE T gamma (T alpha, T b)
 Generates a random number from a gamma distribution with shape alpha and scale b. More...
 
std::enable_if_t< has_counter< T >::value, Philoxforward_state (int n) const
 Returns a new generator with the internal state forwarded by a given number. More...
 

Public Attributes

uint32_t _ctr = 0
 

Additional Inherited Members

- Public Types inherited from openrand::BaseRNG< Philox >
using result_type = uint32_t
 
- Static Public Member Functions inherited from openrand::BaseRNG< Philox >
static constexpr result_type min ()
 
static constexpr result_type max ()
 
- Protected Member Functions inherited from openrand::BaseRNG< Philox >
OPENRAND_DEVICE Ftype u01 (const Utype in) const
 

Detailed Description

Philox generator.

Note
This is a modified version of Philox generator from Random123 library. This uses 4x 32-bit counter, 2x 32-bit key along with 10 rounds.

Constructor & Destructor Documentation

◆ Philox()

OPENRAND_DEVICE openrand::Philox::Philox ( uint64_t  seed,
uint32_t  ctr,
uint32_t  global_seed = openrand::DEFAULT_GLOBAL_SEED,
uint32_t  ctr1 = 0x12345 
)
inline

Construct a new Philox generator.

Note
Internally, global_seed is treated in the same way as other counters, and can be treated as such depending on the application needs.
Parameters
seed64-bit seed
ctr32-bit counter
global_seed(Optional) 32-bit global seed.
ctr1(Optional) Another 32-bit counter exposed for advanced use.

The documentation for this class was generated from the following file: