lab_ml
Lazy Machine Learning
Random Class Reference

Provides random functionality per a given seed. More...

#include <random.h>

Public Member Functions

 Random (unsigned long seed)
 Constructor. More...
 
int nextInt ()
 
template<class T >
void shuffle (vector< T > &array)
 Randomly shuffles a vector with the current seed state. More...
 
template<class T >
void shuffle (vector< T > &array)
 Randomly shuffles a vector with the current seed state. More...
 

Private Member Functions

bool LFSR ()
 This function is taken from Bruce Schneier's \emph{Applied Cryptography}. More...
 

Private Attributes

unsigned long shiftRegister
 

Detailed Description

Provides random functionality per a given seed.

This is useful when you want predictably random things, like for grading.

Constructor & Destructor Documentation

◆ Random()

Random::Random ( unsigned long  seed)
inline

Constructor.

Parameters
seed- seed to initialize the RNG

Member Function Documentation

◆ LFSR()

bool Random::LFSR ( )
inlineprivate

This function is taken from Bruce Schneier's \emph{Applied Cryptography}.

Returns
a random bit

◆ nextInt()

int Random::nextInt ( )
inline
Returns
a random integer

◆ shuffle() [1/2]

template<class T >
void Random::shuffle ( vector< T > &  array)

Randomly shuffles a vector with the current seed state.

Parameters
array- the vector to shuffle

◆ shuffle() [2/2]

template<class T >
void Random::shuffle ( vector< T > &  array)

Randomly shuffles a vector with the current seed state.

Parameters
array- the vector to shuffle

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