Skip to content

Commit

Permalink
feat: added dummy function randbool
Browse files Browse the repository at this point in the history
  • Loading branch information
Sygmei committed May 10, 2023
1 parent 33dc9b5 commit acc7e59
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/Core/Utils/MathUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ namespace obe::utils::math
{
constexpr static double pi = 3.14159265359;

/**
* \brief Get a random bool
* \return A random bool between false and true
*/
bool randbool();

/**
* \brief Get a random integer between the given bound
* \param min Min bound
Expand Down
5 changes: 5 additions & 0 deletions src/Core/Utils/MathUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ namespace obe::utils::math
pcg_extras::seed_seq_from<std::random_device> seed_source;
pcg64 rng(seed_source);

bool randbool()
{
return randfloat() >= 0.5;
}

double randfloat()
{
// do not put const, might fail depending on libc++
Expand Down

0 comments on commit acc7e59

Please sign in to comment.