ATLAS Offline Software
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
FastReseededPRNG Class Reference

#include <FastReseededPRNG.h>

Collaboration diagram for FastReseededPRNG:

Public Types

using result_type = std::uint64_t
 

Public Member Functions

template<typename... Int>
 FastReseededPRNG (Int... seed)
 
 FastReseededPRNG ()=delete
 
result_type operator() ()
 

Static Public Member Functions

static constexpr result_type min ()
 
static constexpr result_type max ()
 

Private Member Functions

void set_seed (const std::uint64_t *start, std::size_t len)
 
std::uint64_t next ()
 

Private Attributes

std::array< std::uint64_t, 2 > m_seed_arr
 

Detailed Description

Definition at line 28 of file FastReseededPRNG.h.

Member Typedef Documentation

◆ result_type

using FastReseededPRNG::result_type = std::uint64_t

Definition at line 30 of file FastReseededPRNG.h.

Constructor & Destructor Documentation

◆ FastReseededPRNG() [1/2]

template<typename... Int>
FastReseededPRNG::FastReseededPRNG ( Int...  seed)
inline

Definition at line 32 of file FastReseededPRNG.h.

32  {
33  const std::array<std::uint64_t, sizeof...(seed)> seed_array{
34  static_cast<std::uint64_t>(seed)...};
35  set_seed(seed_array.data(), seed_array.size());
36  }

◆ FastReseededPRNG() [2/2]

FastReseededPRNG::FastReseededPRNG ( )
delete

Member Function Documentation

◆ max()

static constexpr result_type FastReseededPRNG::max ( )
inlinestaticconstexpr

Definition at line 40 of file FastReseededPRNG.h.

40  {
42  }

◆ min()

static constexpr result_type FastReseededPRNG::min ( )
inlinestaticconstexpr

Definition at line 39 of file FastReseededPRNG.h.

39 { return 0; }

◆ next()

std::uint64_t FastReseededPRNG::next ( )
private

Definition at line 46 of file FastReseededPRNG.cxx.

46  {
47  const std::uint64_t s0 = m_seed_arr[0];
49  const std::uint64_t result = rotl(s0 * 5, 7) * 9;
50 
51  s1 ^= s0;
52  m_seed_arr[0] = rotl(s0, 24) ^ s1 ^ (s1 << 16); // a, b
53  m_seed_arr[1] = rotl(s1, 37); // c
54 
55  return result;
56 }

◆ operator()()

FastReseededPRNG::result_type FastReseededPRNG::operator() ( )

Definition at line 28 of file FastReseededPRNG.cxx.

28  {
29  return next();
30 }

◆ set_seed()

void FastReseededPRNG::set_seed ( const std::uint64_t *  start,
std::size_t  len 
)
private

Definition at line 33 of file FastReseededPRNG.cxx.

33  {
34  const auto hash = XXH3_128bits(start, sizeof(std::uint64_t) * len);
35  m_seed_arr[0] = hash.high64;
36  m_seed_arr[1] = hash.low64;
37 }

Member Data Documentation

◆ m_seed_arr

std::array<std::uint64_t, 2> FastReseededPRNG::m_seed_arr
private

Definition at line 47 of file FastReseededPRNG.h.


The documentation for this class was generated from the following files:
ReadCellNoiseFromCoolCompare.s1
s1
Definition: ReadCellNoiseFromCoolCompare.py:378
get_generator_info.result
result
Definition: get_generator_info.py:21
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
MCP::ScaleSmearParam::s0
@ s0
Generate_dsid_ranseed.seed
seed
Definition: Generate_dsid_ranseed.py:10
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
XXH3_128bits
XXH_PUBLIC_API XXH_PUREF XXH128_hash_t XXH3_128bits(XXH_NOESCAPE const void *data, size_t len)
Unseeded 128-bit variant of XXH3.
lumiFormat.array
array
Definition: lumiFormat.py:91
FastReseededPRNG::next
std::uint64_t next()
Definition: FastReseededPRNG.cxx:46
FastReseededPRNG::set_seed
void set_seed(const std::uint64_t *start, std::size_t len)
Definition: FastReseededPRNG.cxx:33
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
FastReseededPRNG::m_seed_arr
std::array< std::uint64_t, 2 > m_seed_arr
Definition: FastReseededPRNG.h:47