Cayley
Pseudo-Random Bits from Finite Groups
Public Member Functions | Private Member Functions | List of all members
Cayley32 Class Reference

The Cayley PRNG over \(S_{32}\) with fixed generators. More...

#include <Cayley32.h>

Inheritance diagram for Cayley32:
Cayley32e CCayley

Public Member Functions

 Cayley32 ()
 Constructor. More...
 
void srand (uintx_t &seed)
 Seed the generator. More...
 
- Public Member Functions inherited from Cayley32e
 Cayley32e ()
 Constructor.
 
uint64_t rand ()
 Generate 64 pseudo-random bits. More...
 
- Public Member Functions inherited from CCayley
 CCayley (uint32_t n)
 Constructor. More...
 
 ~CCayley ()
 Destructor. More...
 
virtual void srand (uint64_t(*rnd)(void))
 Seed the generator. More...
 
CPerm GetGenerator (int i) const
 Get generator. More...
 
const CPermGetPerm () const
 Get current permutation. More...
 
const uint32_t GetSize () const
 Get permutation size. More...
 

Private Member Functions

void ChooseGenerators ()
 Choose generators. More...
 

Additional Inherited Members

- Protected Member Functions inherited from CCayley
void ChooseGenerators (uint64_t(*rnd)(void))
 Choose generators. More...
 
void NextPerm ()
 Compute next permutation. More...
 
- Protected Attributes inherited from CCayley
uint32_t m_nSize = 0
 Size of permutations.
 
uint32_t m_nOrder = 0
 Order of generators.
 
CPowerTable m_nPower [2]
 Power tables for a pair of generators.
 
CPermm_pCurPerm = nullptr
 Current permutation.
 
uint64_t m_nDelayLine [m_nDelay]
 Delay line. More...
 
int m_nTail = 0
 Index of last element in delay line.
 
- Static Protected Attributes inherited from CCayley
static const int m_nDelay = 32
 Delay size.
 

Detailed Description

A 64-bit Cayley PRNG with permutation size 32 and fixed generators.

Definition at line 26 of file Cayley32.h.

Constructor & Destructor Documentation

◆ Cayley32()

Cayley32::Cayley32 ( )

The default constructor declares Cayley32 to be a 64-bit instance of CCayley with a permutation size of 32.

Definition at line 54 of file Cayley32.cpp.

Member Function Documentation

◆ ChooseGenerators()

void Cayley32::ChooseGenerators ( )
private

Choose the generators and initialize the power tables. A pair of fixed generators is used here, but they should be replaced and not be made public to protect against reverse engineering. CCayley::ChooseGenerators() will find generators that have a high probability of being strong.

Definition at line 63 of file Cayley32.cpp.

◆ srand()

void Cayley32::srand ( uintx_t seed)

Initialize the pseudorandom number generator by choosing the generators and choosing a pseudorandom initial permutation.

Parameters
seedSeed value.

Definition at line 78 of file Cayley32.cpp.