RAND_MAX properly defined in upstream NuttX

This commit is contained in:
David Sidrane 2016-12-12 14:07:47 -10:00 committed by Lorenz Meier
parent c9f10107c0
commit dec46927f7
2 changed files with 3 additions and 4 deletions

View File

@ -500,7 +500,7 @@ public:
virtual ~BlockRandUniform() {};
float update()
{
static float rand_max = MAX_RAND;
static float rand_max = RAND_MAX;
float rand_val = rand();
float bounds = getMax() - getMin();
return getMin() + (rand_val * bounds) / rand_max;
@ -537,8 +537,8 @@ public:
if (phase == 0) {
do {
float U1 = (float)rand() / MAX_RAND;
float U2 = (float)rand() / MAX_RAND;
float U1 = (float)rand() / RAND_MAX;
float U2 = (float)rand() / RAND_MAX;
V1 = 2 * U1 - 1;
V2 = 2 * U2 - 1;
S = V1 * V1 + V2 * V2;

View File

@ -41,7 +41,6 @@
#pragma once
#pragma GCC diagnostic push
#define RAND_MAX __RAND_MAX
#pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wfloat-equal"
#define _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC 1