42 #include <px4_platform_common/defines.h> 75 static float V1, V2, S;
81 float U1 = (float)rand() / RAND_MAX;
82 float U2 = (float)rand() / RAND_MAX;
85 S = V1 * V1 + V2 * V2;
86 }
while (S >= 1 || fabsf(S) < 1e-8
f);
88 X = V1 * float(sqrtf(-2 *
float(logf(S)) / S));
91 X = V2 * float(sqrtf(-2 *
float(logf(S)) / S));
95 return X * getStdDev() + getMean();
BlockRandGauss(SuperBlock *parent, const char *name)
control::BlockParamFloat _mean
Vector< float, 6 > f(float t, const Matrix< float, 6, 1 > &, const Matrix< float, 3, 1 > &)
control::BlockParamFloat _stdDev