#include "Math.hpp"
#include <algorithm>

const double Math::PI = 3.14159265358979323846;
const double Math::PIdiv2 = Math::PI / 2;
const double Math::PIdiv4 = Math::PI / 4;
const double Math::PImul2 = Math::PI * 2;
const double Math::SQRT2 = 1.4142135;
const double Math::SQRT2div2 = Math::SQRT2 / 2;
const double Math::SQRT3 = 1.730508;
const double Math::SIN30 = 0.5;
const double Math::SIN45 = Math::SQRT2 / 2.0;
const double Math::SIN60 = Math::SQRT3 / 2.0;
const double Math::COS30 = Math::SIN60;
const double Math::COS45 = Math::SIN45;
const double Math::COS60 = Math::SIN30;
const double Math::TAN30 = Math::SIN30 / Math::COS30;
const double Math::TAN45 = 1.0;
const double Math::TAN60 = Math::SIN60 / Math::COS60;
const double Math::Div3 = 1.0 / 3;

const double Math::rand(const double min) {
  return min + static_cast<double>(
    std::rand()
  ) / RAND_MAX;
}

const bool Math::checkRand(const double probability) {
  return rand() < (std::min)(
    probability,
    1.0
  );
}

