Markopy
Utilizing Markov Models for brute forcing attacks
random.h File Reference

Random engine implementations for Markov. More...

#include <random>
#include <iostream>
Include dependency graph for random.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Markov::Random::RandomEngine
 An abstract class for Random Engine. More...
 
class  Markov::Random::DefaultRandomEngine
 Implementation using Random.h default random engine. More...
 
class  Markov::Random::Marsaglia
 Implementation of Marsaglia Random Engine. More...
 
class  Markov::Random::Mersenne
 Implementation of Mersenne Twister Engine. More...
 

Namespaces

 Markov
 Namespace for the markov-model related classes. Contains Model, Node and Edge classes.
 
 Markov::Random
 Objects related to RNG.
 

Detailed Description

Random engine implementations for Markov.

Authors
Ata Hakçıl

An abstract class for Random Engine. This class is used for generating random numbers, which are used for random walking on the graph.

Main reason behind allowing different random engines is that some use cases may favor performance, while some favor good random.

Mersenne can be used for truer random, while Marsaglia can be used for deterministic but fast random.

Implementation using Random.h default random engine. This engine is also used by other engines for seeding.

Example Use: Using Default Engine with RandomWalk

Model.import("model.mdl");
char* res = new char[11];
for (int i = 0; i < 10; i++) {
this->RandomWalk(&randomEngine, 5, 10, res);
std::cout << res << "\n";
}
Implementation using Random.h default random engine.
Definition: random.h:61

Example Use: Generating a random number with Marsaglia Engine

std::cout << de.random();
unsigned long random()
Generate Random Number.
Definition: random.h:66

Implementation of Marsaglia Random Engine. This is an implementation of Marsaglia Random engine, which for most use cases is a better fit than other solutions. Very simple mathematical formula to generate pseudorandom integer, so its crazy fast.

This implementation of the Marsaglia Engine is seeded by random.h default random engine. RandomEngine is only seeded once so its not a performance issue.

Example Use: Using Marsaglia Engine with RandomWalk

Model.import("model.mdl");
char* res = new char[11];
Markov::Random::Marsaglia MarsagliaRandomEngine;
for (int i = 0; i < 10; i++) {
this->RandomWalk(&MarsagliaRandomEngine, 5, 10, res);
std::cout << res << "\n";
}
Implementation of Marsaglia Random Engine.
Definition: random.h:125

Example Use: Generating a random number with Marsaglia Engine

std::cout << me.random();
unsigned long random()
Generate Random Number.
Definition: random.h:140

Definition in file random.h.