26 lines
441 B
C++
26 lines
441 B
C++
|
#include "util.hpp"
|
||
|
|
||
|
#include <cstdlib>
|
||
|
|
||
|
namespace util {
|
||
|
float randf_m1_1()
|
||
|
{
|
||
|
return 2.0f*randf_0_1() - 1.0f;
|
||
|
}
|
||
|
|
||
|
float randf_0_1()
|
||
|
{
|
||
|
return static_cast<float>(static_cast<double>(rand()) / (double) RAND_MAX);
|
||
|
}
|
||
|
|
||
|
glm::vec2 randv2_m1_1()
|
||
|
{
|
||
|
return glm::vec2(randf_m1_1(), randf_m1_1());
|
||
|
}
|
||
|
|
||
|
glm::vec2 randv2_0_1()
|
||
|
{
|
||
|
return glm::vec2(randf_0_1(), randf_0_1());
|
||
|
}
|
||
|
}
|