#include <TerrainRandom.h>
float TerrainRandom::GetRandomFloatGaussian |
( |
float |
mean, |
|
|
float |
standardDeviation |
|
) |
| |
|
static |
Returns a pseudo-random float given by a normal distribution specified by its statistical parameters. Based on the Marsaglia polar method (more efficient Box-Muller algorithm).
[Inspired] by sample implementation from http://en.wikipedia.org/wiki/Marsaglia_polar_method
- Parameters
-
[in] | mean | Mean value of the normal distribution. |
[in] | standardDeviation | Standard deviation of the normal distribution. |
[in] | Pseudo-random | float given by normal distribution. |
float TerrainRandom::GetRandomFloatGaussianBasedOnPointDistance |
( |
int |
x1, |
|
|
int |
y1, |
|
|
int |
x2, |
|
|
int |
y2 |
|
) |
| |
|
static |
Return a pseudo-random gaussian number with a normal distribution with standard deviation proportionate to the point distance on the surface. The closer the points are, the smaller the standard deviation is and vice versa.
[Corrected] formula taken from Modern Computer Graphics (2004), page 279.
- Parameters
-
[in] | x1 | X-coordinate of the first point. |
[in] | y1 | Y-coordinate of the first point. |
[in] | x2 | X-coordinate of the second point. |
[in] | y2 | Y-coordinate of the second point. |
- Returns
- Pseudo-random float generated with normal distribution dependent on point distance.
static float APNature::TerrainRandom::GetRandomFloatUniform |
( |
float |
from, |
|
|
float |
to |
|
) |
| |
|
inlinestatic |
Returns a pseudo-random float from the interval given by its boundaries (boundaries included) with a uniform probability distribution. Sampling of the float values depends on value RAND_MAX from the standard library (theoretically RAND_MAX possible results).
- Parameters
-
[in] | from | Lower interval boundary. |
[in] | to | Upper interval boundary. |
- Returns
- Pseudo-random float from the interval given by its boundaries.
The documentation for this class was generated from the following files: