hx3d
1
2D/3D Simple Game Framework
|
Weighted random generator with callbacks. More...
#include <random.hpp>
Public Member Functions | |
void | define (int i, int weight, std::function< void()> f) |
Define a value with a weight and a callback. More... | |
int | random () |
Choose a random number and execute the callback. More... | |
Weighted random generator with callbacks.
Example code
Definition at line 52 of file random.hpp.
void hx3d::math::WeightedRandom::define | ( | int | i, |
int | weight, | ||
std::function< void()> | f | ||
) |
Define a value with a weight and a callback.
i | Value |
weight | Weight |
f | Callback |
Definition at line 32 of file random.cpp.
int hx3d::math::WeightedRandom::random | ( | ) |
Choose a random number and execute the callback.
Definition at line 42 of file random.cpp.