diff options
author | Jun Zhang <zhangjunphy@gmail.com> | 2015-12-05 21:00:11 +0800 |
---|---|---|
committer | BlockMen <nmuelll@web.de> | 2015-12-06 11:38:03 +0100 |
commit | a78dd7f2b6b0e1fefdbaa1ae21b722dd4459e4f4 (patch) | |
tree | ace45f38b9a951185b158fb7e3435680afb5d376 /src/noise.cpp | |
parent | 70ece71ee4e8f8bff5cbc572710c0fa6fc3b355f (diff) | |
download | minetest-a78dd7f2b6b0e1fefdbaa1ae21b722dd4459e4f4.tar.gz minetest-a78dd7f2b6b0e1fefdbaa1ae21b722dd4459e4f4.tar.bz2 minetest-a78dd7f2b6b0e1fefdbaa1ae21b722dd4459e4f4.zip |
Fix spelling of noise_threshold
Diffstat (limited to 'src/noise.cpp')
-rw-r--r-- | src/noise.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/noise.cpp b/src/noise.cpp index b1b702538..2ddc3926f 100644 --- a/src/noise.cpp +++ b/src/noise.cpp @@ -99,17 +99,17 @@ u32 PcgRandom::range(u32 bound) Using rand() % 3, the number 0 would be twice as likely to appear. With a very large RNG range, the effect becomes less prevalent but still present. This can be solved by modifying the range of the RNG - to become a multiple of bound by dropping values above the a threshhold. - In our example, threshhold == 4 - 3 = 1 % 3 == 1, so reject 0, thus + to become a multiple of bound by dropping values above the a threshold. + In our example, threshold == 4 - 3 = 1 % 3 == 1, so reject 0, thus making the range 3 with no bias. This loop looks dangerous, but will always terminate due to the RNG's property of uniformity. */ - u32 threshhold = -bound % bound; + u32 threshold = -bound % bound; u32 r; - while ((r = next()) < threshhold) + while ((r = next()) < threshold) ; return r % bound; |