forked from Archive/PX4-Autopilot
RAND_MAX properly defined in upstream NuttX
This commit is contained in:
parent
c9f10107c0
commit
dec46927f7
|
@ -500,7 +500,7 @@ public:
|
||||||
virtual ~BlockRandUniform() {};
|
virtual ~BlockRandUniform() {};
|
||||||
float update()
|
float update()
|
||||||
{
|
{
|
||||||
static float rand_max = MAX_RAND;
|
static float rand_max = RAND_MAX;
|
||||||
float rand_val = rand();
|
float rand_val = rand();
|
||||||
float bounds = getMax() - getMin();
|
float bounds = getMax() - getMin();
|
||||||
return getMin() + (rand_val * bounds) / rand_max;
|
return getMin() + (rand_val * bounds) / rand_max;
|
||||||
|
@ -537,8 +537,8 @@ public:
|
||||||
|
|
||||||
if (phase == 0) {
|
if (phase == 0) {
|
||||||
do {
|
do {
|
||||||
float U1 = (float)rand() / MAX_RAND;
|
float U1 = (float)rand() / RAND_MAX;
|
||||||
float U2 = (float)rand() / MAX_RAND;
|
float U2 = (float)rand() / RAND_MAX;
|
||||||
V1 = 2 * U1 - 1;
|
V1 = 2 * U1 - 1;
|
||||||
V2 = 2 * U2 - 1;
|
V2 = 2 * U2 - 1;
|
||||||
S = V1 * V1 + V2 * V2;
|
S = V1 * V1 + V2 * V2;
|
||||||
|
|
|
@ -41,7 +41,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#define RAND_MAX __RAND_MAX
|
|
||||||
#pragma GCC diagnostic ignored "-Wshadow"
|
#pragma GCC diagnostic ignored "-Wshadow"
|
||||||
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||||
#define _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC 1
|
#define _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC 1
|
||||||
|
|
Loading…
Reference in New Issue