forked from Archive/PX4-Autopilot
controllib: fix implicit cast warn with clang 10
This commit is contained in:
parent
4f82f028e7
commit
44be9d5568
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue