Files
cocos4/native/cocos/math/Utils.cpp
T
minggo 271cc5cf23 Remove some format rule (#10919)
* remove some rules
* format all codes with new format rule
2022-05-04 13:09:24 +08:00

31 lines
544 B
C++

#include "cocos/math/Utils.h"
#include <algorithm>
#include <cmath>
#include <random>
#include "math/Math.h"
namespace {
std::random_device rd;
std::uniform_real_distribution<float> uniformReal{0.0F, 1.0F};
} // namespace
namespace cc {
namespace mathutils {
float random() {
return uniformReal(rd);
}
Vec3ElementType absMaxComponent(const Vec3 &v) {
return absMax(absMax(v.x, v.y), v.z);
}
Vec3ElementType maxComponent(const Vec3 &v) {
return std::max(std::max(v.x, v.y), v.z);
}
} // namespace mathutils
} // namespace cc