Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

RandomNumberGenerator Class Reference

abstract base class for random number generators. More...

#include <cryptlib.h>

Inheritance diagram for RandomNumberGenerator:

ARC4 BlockingRng CounterMode LC_RNG NonblockingRng NullRNG OFB PublicBlumBlumShub RandomPool SapphireRNG SEAL X917RNG List of all members.

Public Methods

virtual ~RandomNumberGenerator ()
virtual byte GenerateByte ()=0
 generate new random byte and return it.

virtual unsigned int GenerateBit ()
 generate new random bit and return it. More...

virtual word32 GenerateWord32 (word32 a=0,word32 b=0xffffffffL)
 generate a random 32 bit word in the range min to max, inclusive. More...

virtual void GenerateBlock (byte *output,unsigned int size)
 generate random array of bytes. More...

template<class IT> void Shuffle (IT begin,IT end)
 randomly shuffle the specified array, resulting permutation is uniformly distributed. More...

byte GetByte ()
unsigned int GetBit ()
word32 GetLong (word32 a=0,word32 b=0xffffffffL)
word16 GetShort (word16 a=0,word16 b=0xffff)
void GetBlock (byte *output,unsigned int size)

Detailed Description

abstract base class for random number generators.

All return values are uniformly distributed over the range specified.

Definition at line 160 of file cryptlib.h.


Constructor & Destructor Documentation

RandomNumberGenerator::~RandomNumberGenerator ( ) [inline, virtual]
 

Definition at line 164 of file cryptlib.h.


Member Function Documentation

unsigned int RandomNumberGenerator::GenerateBit ( ) [virtual]
 

generate new random bit and return it.

Default implementation is to call GenerateByte() and return its parity.

Reimplemented in PublicBlumBlumShub.

Definition at line 14 of file cryptlib.cpp.

void RandomNumberGenerator::GenerateBlock ( byte * output,
unsigned int size ) [virtual]
 

generate random array of bytes.

Reimplemented in NonblockingRng, BlockingRng, and RandomPool.

Definition at line 19 of file cryptlib.cpp.

Referenced by SecretSharing::Put().

word32 RandomNumberGenerator::GenerateWord32 ( word32 a = 0,
word32 b = 0xffffffffL ) [virtual]
 

generate a random 32 bit word in the range min to max, inclusive.

Definition at line 25 of file cryptlib.cpp.

Referenced by Shuffle().

unsigned int RandomNumberGenerator::GetBit ( ) [inline]
 

Definition at line 189 of file cryptlib.h.

void RandomNumberGenerator::GetBlock ( byte * output,
unsigned int size ) [inline]
 

Definition at line 192 of file cryptlib.h.

byte RandomNumberGenerator::GetByte ( ) [inline]
 

Definition at line 188 of file cryptlib.h.

word32 RandomNumberGenerator::GetLong ( word32 a = 0,
word32 b = 0xffffffffL ) [inline]
 

Definition at line 190 of file cryptlib.h.

word16 RandomNumberGenerator::GetShort ( word16 a = 0,
word16 b = 0xffff ) [inline]
 

Definition at line 191 of file cryptlib.h.

template<class IT>
void RandomNumberGenerator::Shuffle ( IT begin,
IT end ) [inline]
 

randomly shuffle the specified array, resulting permutation is uniformly distributed.

Definition at line 181 of file cryptlib.h.


The documentation for this class was generated from the following files:
Generated at Mon Jan 15 01:17:01 2001 for Crypto++ by doxygen1.2.4 written by Dimitri van Heesch, © 1997-2000