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

The Cayley PRNG over \(S_{32}\) with pseudo-random generators. More...

#include <Cayley32.h>

Inheritance diagram for Cayley32e:
CCayley Cayley32

Public Member Functions

 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...
 

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 pseudo-random generators generated using the Mersenne Twister.

Definition at line 14 of file Cayley32.h.

Member Function Documentation

◆ rand()

uint64_t Cayley32e::rand ( )

Generate a pseudo-random permutation and map it to a 64-bit unsigned int, as follows. Update the current permutation, then exclusive-or together the product of the permutation map entries times 32 random strings. These strings are fixed in this implementation but they should be replaced and not be made public to protect against reverse engineering.

Returns
A pseudo-random 64-bit unsigned integer.

Definition at line 20 of file Cayley32.cpp.