Menge
Modular Pedestrian Simulation Framework for Research and Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Namespaces | Functions
RandGenerator.h File Reference

Utility for generating number distributions. More...

#include "CoreConfig.h"
#include "vector.h"
#include <iostream>
#include <vector>
#include "SimpleLock.h"

Go to the source code of this file.

Classes

class  Menge::Math::FloatGenerator
 Generic abstract class which generates a scalar float value. More...
 
class  Menge::Math::ConstFloatGenerator
 A FloatGenerator which returns a constant value. More...
 
class  Menge::Math::NormalFloatGenerator
 A FloatGenerator which returns a normally distributed value. More...
 
class  Menge::Math::UniformFloatGenerator
 A FloatGenerator which returns a uniformly distributed value within a defined range. More...
 
class  Menge::Math::IntGenerator
 Generic abstract class which generates a scalar integer value. More...
 
class  Menge::Math::ConstIntGenerator
 An IntGenerator which returns a constant value. More...
 
class  Menge::Math::UniformIntGenerator
 An IntGenerator which returns a uniformly distributed value within a defined range. More...
 
class  Menge::Math::Vec2DGenerator
 Generic abstract class which generates a 2D vector float values. More...
 
class  Menge::Math::Zero2DGenerator
 A 2D float generator which always returns a zero. More...
 
class  Menge::Math::Const2DGenerator
 A 2D float generator which always returns a constant 2D vector. More...
 
class  Menge::Math::AABBUniformPosGenerator
 Generates a 2D float value uniformly distributed in an axis-aligned box (AAB). More...
 
class  Menge::Math::OBBUniformPosGenerator
 Generates a 2D float value uniformly distributed in an oriented box (OB). More...
 
class  Menge::Math::WeightedInt
 A weighted integer value. Used with WeightedIntGenerator. More...
 
class  Menge::Math::WeightedIntGenerator
 A number generator based on a weighted probability of a discrete value set. More...
 

Namespaces

 Menge
 The core namespace. All elements of Menge are contained in this namespace.
 

Functions

void Menge::Math::setDefaultGeneratorSeed (int seed)
 Allows the global random number seed value to be set. More...
 
int Menge::Math::getDefaultSeed ()
 Based on the default seed state, return a random generator seed. More...
 
FloatGenerator * Menge::Math::createFloatGenerator (TiXmlElement *node, float scale=1.f, const std::string &prefix="")
 Creates a float generator from an xml node. More...
 
IntGenerator * Menge::Math::createIntGenerator (TiXmlElement *node, const std::string &prefix="")
 Creates an int generator from an xml node. More...
 
Vec2DGenerator * Menge::Math::create2DGenerator (TiXmlElement *node, float scale=1.f)
 Creates a 2D vector generator from an xml node. More...
 

Detailed Description

Utility for generating number distributions.

Number generators simple purpose is to produce a value, scalar or vector, float or int. These values may be constant or random with either normal or uniform distributions. The number generator provides an interface so that the various entities do not need to know anything about the value type or distribution.

When pointers to number generators are passed around, "ownership" never changes. I.e., the caller is still responsible for the eventually freeing up the memory. If the callee needs to save an instance of the generator (rather than simply just using it to obtain a value) it is responsible for calling the copy method to obtain its own unique copy. It is then responsible for freeing up that copy.