mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-24 15:40:31 +08:00
controllib: fix implicit cast warn with clang 10
This commit is contained in:
@@ -78,8 +78,8 @@ public:
|
||||
|
||||
if (phase == 0) {
|
||||
do {
|
||||
float U1 = (float)rand() / RAND_MAX;
|
||||
float U2 = (float)rand() / RAND_MAX;
|
||||
float U1 = static_cast<float>(rand()) / static_cast<float>(RAND_MAX);
|
||||
float U2 = static_cast<float>(rand()) / static_cast<float>(RAND_MAX);
|
||||
V1 = 2 * U1 - 1;
|
||||
V2 = 2 * U2 - 1;
|
||||
S = V1 * V1 + V2 * V2;
|
||||
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
virtual ~BlockRandUniform() = default;
|
||||
float update()
|
||||
{
|
||||
static float rand_max = RAND_MAX;
|
||||
static float rand_max = static_cast<float>(RAND_MAX);
|
||||
float rand_val = rand();
|
||||
float bounds = getMax() - getMin();
|
||||
return getMin() + (rand_val * bounds) / rand_max;
|
||||
|
||||
Reference in New Issue
Block a user