33 lines
555 B
C++
33 lines
555 B
C++
|
/*
|
||
|
* Random.cpp
|
||
|
*
|
||
|
* Created on: Dec 10, 2016
|
||
|
* Author: tibi
|
||
|
*/
|
||
|
|
||
|
#include <utils/Random.h>
|
||
|
|
||
|
namespace farmlands {
|
||
|
namespace utils {
|
||
|
|
||
|
float Random::getFloat()
|
||
|
{
|
||
|
std::uniform_real_distribution<float> distrib;
|
||
|
return distrib(m_engine);
|
||
|
}
|
||
|
|
||
|
int Random::getInt(int min, int max)
|
||
|
{
|
||
|
std::uniform_int_distribution<int> distrib(min, max);
|
||
|
return distrib(m_engine);
|
||
|
}
|
||
|
|
||
|
int Random::getInt(int max)
|
||
|
{
|
||
|
std::uniform_real_distribution<float> distrib(0, max);
|
||
|
return distrib(m_engine);
|
||
|
}
|
||
|
|
||
|
} /* namespace utils */
|
||
|
} /* namespace farmlands */
|