19 static constexpr const char* ToString(
const EAngleUnit AngleUnit)
23 case EAngleUnit::Degree:
return "Degree";
24 case EAngleUnit::Radian:
return "Radian";
27 LK_CORE_VERIFY(
false,
"Enum::ToString(const EAngleUnit) failed with value: {}",
static_cast<int>(AngleUnit));
34namespace LkEngine::Math {
37 static T GenerateRandomNumber()
39 static_assert(std::is_integral<T>::value,
"T must be an integral type");
40 constexpr T Min = std::numeric_limits<T>::min();
41 constexpr T Max = std::numeric_limits<T>::max();
42 LK_CORE_ASSERT(Min <= Max,
"Minimum value has to be less than or equal to maximum, min: {}, max: {}", Min, Max);
44 thread_local static std::mt19937 Generator(std::random_device{}());
45 thread_local static std::uniform_int_distribution<typename std::make_unsigned<T>::type> Distribution;
48 return static_cast<T
>(Distribution(Generator,
49 typename std::uniform_int_distribution<
typename std::make_unsigned<T>::type>::param_type{
50 static_cast<typename std::make_unsigned<T>::type
>(Min),
51 static_cast<typename std::make_unsigned<T>::type
>(Max)
Mathematics used by the engine.