proxygen
Random Class Reference

Public Member Functions

uint64_t Value ()
 
void Init (uint64_t seed)
 
uint64_t Value ()
 
void Init (uint64_t seed)
 

Static Private Member Functions

static uint64_t Rot64 (uint64_t x, int k)
 
static uint64_t Rot64 (uint64_t x, int k)
 

Private Attributes

uint64_t m_a
 
uint64_t m_b
 
uint64_t m_c
 
uint64_t m_d
 

Detailed Description

Definition at line 48 of file SpookyHashV1Test.cpp.

Member Function Documentation

void Random::Init ( uint64_t  seed)
inline

Definition at line 61 of file SpookyHashV1Test.cpp.

References i, m_a, m_b, m_c, m_d, seed, and Value().

Referenced by TestDeltas().

62  {
63  m_a = 0xdeadbeef;
64  m_b = m_c = m_d = seed;
65  for (int i = 0; i < 20; ++i) {
66  (void)Value();
67  }
68  }
static const int seed
uint64_t m_b
uint64_t m_c
uint64_t m_a
uint64_t m_d
uint64_t Value()
void Random::Init ( uint64_t  seed)
inline

Definition at line 61 of file SpookyHashV2Test.cpp.

References i, m_a, m_b, m_c, m_d, seed, and Value().

62  {
63  m_a = 0xdeadbeef;
64  m_b = m_c = m_d = seed;
65  for (int i = 0; i < 20; ++i) {
66  (void)Value();
67  }
68  }
static const int seed
uint64_t m_b
uint64_t m_c
uint64_t m_a
uint64_t m_d
uint64_t Value()
static uint64_t Random::Rot64 ( uint64_t  x,
int  k 
)
inlinestaticprivate

Definition at line 71 of file SpookyHashV2Test.cpp.

References k, m_a, m_b, m_c, m_d, and uint64_t.

72  {
73  return (x << k) | (x >> (64-(k)));
74  }
Definition: InvokeTest.cpp:58
KeyT k
static uint64_t Random::Rot64 ( uint64_t  x,
int  k 
)
inlinestaticprivate

Definition at line 71 of file SpookyHashV1Test.cpp.

References k.

Referenced by Value().

72  {
73  return (x << k) | (x >> (64-(k)));
74  }
Definition: InvokeTest.cpp:58
KeyT k
uint64_t Random::Value ( )
inline

Definition at line 51 of file SpookyHashV2Test.cpp.

References m_a, m_b, m_c, m_d, Rot64(), and uint64_t.

52  {
53  uint64_t e = m_a - Rot64(m_b, 23);
54  m_a = m_b ^ Rot64(m_c, 16);
55  m_b = m_c + Rot64(m_d, 11);
56  m_c = m_d + e;
57  m_d = e + m_a;
58  return m_d;
59  }
static uint64_t Rot64(uint64_t x, int k)
uint64_t m_b
uint64_t m_c
uint64_t m_a
uint64_t m_d
uint64_t Random::Value ( )
inline

Definition at line 51 of file SpookyHashV1Test.cpp.

References m_a, m_b, m_c, m_d, Rot64(), and uint64_t.

Referenced by Init(), and TestDeltas().

52  {
53  uint64_t e = m_a - Rot64(m_b, 23);
54  m_a = m_b ^ Rot64(m_c, 16);
55  m_b = m_c + Rot64(m_d, 11);
56  m_c = m_d + e;
57  m_d = e + m_a;
58  return m_d;
59  }
static uint64_t Rot64(uint64_t x, int k)
uint64_t m_b
uint64_t m_c
uint64_t m_a
uint64_t m_d

Member Data Documentation

uint64_t Random::m_a
private

Definition at line 76 of file SpookyHashV1Test.cpp.

Referenced by Init(), Rot64(), and Value().

uint64_t Random::m_b
private

Definition at line 77 of file SpookyHashV1Test.cpp.

Referenced by Init(), Rot64(), and Value().

uint64_t Random::m_c
private

Definition at line 78 of file SpookyHashV1Test.cpp.

Referenced by Init(), Rot64(), and Value().

uint64_t Random::m_d
private

Definition at line 79 of file SpookyHashV1Test.cpp.

Referenced by Init(), Rot64(), and Value().


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