Pseudo random number generation functions.
More...
|
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...
|
|
Pseudo random number generation functions.
◆ 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
-
area | sf::FloatRect within which the points are distributed |
minDist | minimum distance between points |
maxPoints | maximum number of points to try generating |
engine | Seeded 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
-
begin | Minimum value |
end | Maximum value |
engine | Seeded 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
-
begin | Minimum value |
end | Maximum value |
engine | Seeded random engine to use. Defaults to (non-threadsafe) instance seeded with current time |