xyginext  0.2.0
Second generation of xygine game creation framework
Functions
xy::Util::Random Namespace Reference

Pseudo random number generation functions. More...

Functions

static std::mt19937 rndEngine (static_cast< unsigned long >(std::time(nullptr)))
 
static float value (float begin, float end, std::mt19937 &engine=rndEngine)
 Returns a pseudo random floating point value. More...
 
static int value (int begin, int end, std::mt19937 &engine=rndEngine)
 Returns a pseudo random integer value. More...
 
XY_EXPORT_API std::vector< sf::Vector2f > poissonDiscDistribution (const sf::FloatRect &area, float minDist, std::size_t maxPoints, std::mt19937 &engine=rndEngine)
 Returns a poission disc sampled distribution of points within a given area. More...
 

Detailed Description

Pseudo random number generation functions.

Function Documentation

◆ poissonDiscDistribution()

XY_EXPORT_API std::vector<sf::Vector2f> xy::Util::Random::poissonDiscDistribution ( const sf::FloatRect &  area,
float  minDist,
std::size_t  maxPoints,
std::mt19937 &  engine = rndEngine 
)

Returns a poission disc sampled distribution of points within a given area.

Parameters
areasf::FloatRect within which the points are distributed
minDistminimum distance between points
maxPointsmaximum number of points to try generating
engineSeeded random engine to use. Defaults to (non-threadsafe) instance seeded with current time

◆ value() [1/2]

static float xy::Util::Random::value ( float  begin,
float  end,
std::mt19937 &  engine = rndEngine 
)
inlinestatic

Returns a pseudo random floating point value.

Parameters
beginMinimum value
endMaximum value
engineSeeded random engine to use. Defaults to (non-threadsafe) instance seeded with current time

◆ value() [2/2]

static int xy::Util::Random::value ( int  begin,
int  end,
std::mt19937 &  engine = rndEngine 
)
inlinestatic

Returns a pseudo random integer value.

Parameters
beginMinimum value
endMaximum value
engineSeeded random engine to use. Defaults to (non-threadsafe) instance seeded with current time