Behold, the newest C++ library which can make game development easier.
Many games, including the one I develop with cocos2d-x often works with randomness. Therefore, at the beginning of my projects I developed a library that greatly simplifies working with randomness in C++.
The time has come - all the power of the randomness is hidden in one header file.
90% of the randomness can be controlled through ONE get
method
Examples:
- Get random number in range
auto val = Random::get(-1, 1); // Integer
auto val = Random::get(1.f, -1.f); // Float point
- Get bool with [0; 1] probability
if( Random::get( .5) ) // 50% probability of true
{
âŚ
}
- Random value from std::initilizer_list
// Set random color from init_list
setColor( Random::get( {
Color3B::MAGENTA, Color3B::YELLOW,
Color3B::ORANGE, Color3B::RED } ) );
- Random iterator from container
auto randomSprite = Random::get( sprites );
And even more! Check out github page: