mirror of
https://github.com/love2d/love.git
synced 2026-08-20 20:49:54 +02:00
Fix typos and compiler warnings (see comments to 2b3afd95a23f).
This commit is contained in:
+4
-4
@@ -4,9 +4,9 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
// The Box–Muller transform generates two random numbers, one of which we cache here.
|
||||
// A value +infinity is used to signal the cache is invalid and that new numbers have
|
||||
// to be generated.
|
||||
// The Box–Muller transform generates two random numbers, one of which we
|
||||
// cache here. A value of +infinity is used to signal the cache is invalid
|
||||
// and that new numbers have to be generated.
|
||||
float last_randnormal = std::numeric_limits<float>::infinity();
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ float random_normal(float o)
|
||||
|
||||
// else: generate numbers using the Box-Muller transform
|
||||
float a = sqrt(-2.0f * log(random()));
|
||||
float b = LOVE_M_PI * 2.0f * random();
|
||||
float b = float(LOVE_M_PI) * 2.0f * random();
|
||||
last_randnormal = a * cos(b);
|
||||
return a * sin(b) * o;
|
||||
}
|
||||
|
||||
+3
-2
@@ -87,7 +87,8 @@ inline float next_p2(float x)
|
||||
*/
|
||||
inline float random()
|
||||
{
|
||||
return float(rand()) / (float(RAND_MAX) + 1.0f);
|
||||
// to satisfy picky compilers...
|
||||
return float(double(rand() % RAND_MAX) / double(RAND_MAX));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,7 +115,7 @@ inline float random(float min, float max)
|
||||
* @returns Normal distributed random number with mean 0 and variance o^2.
|
||||
*/
|
||||
float random_normal(float o = 1.);
|
||||
#define random_gaussion random_normal
|
||||
#define random_gaussian random_normal
|
||||
|
||||
} // love
|
||||
|
||||
|
||||
Reference in New Issue
Block a user