diff options
author | Lexi Hale <5723574+velartrill@users.noreply.github.com> | 2022-07-13 11:57:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-13 11:57:12 +0200 |
commit | 20bd6bdb685af11548c35d3a48e5aa33f4222397 (patch) | |
tree | 6f60bad900cdb0ea28606bfe3f860b4948eeb277 /src/util/numeric.cpp | |
parent | 8724fe6e3fc2b6c0b78123f1f95fd8c6c6817dd5 (diff) | |
download | hax-minetest-server-20bd6bdb685af11548c35d3a48e5aa33f4222397.tar.gz hax-minetest-server-20bd6bdb685af11548c35d3a48e5aa33f4222397.zip |
Animated particlespawners and more (#11545)
Co-authored-by: Lars Mueller <appgurulars@gmx.de>
Co-authored-by: sfan5 <sfan5@live.de>
Co-authored-by: Dmitry Kostenko <codeforsmile@gmail.com>
Diffstat (limited to 'src/util/numeric.cpp')
-rw-r--r-- | src/util/numeric.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/util/numeric.cpp b/src/util/numeric.cpp index 702ddce95..aa3bb843d 100644 --- a/src/util/numeric.cpp +++ b/src/util/numeric.cpp @@ -46,11 +46,22 @@ void myrand_bytes(void *out, size_t len) g_pcgrand.bytes(out, len); } +float myrand_float() +{ + u32 uv = g_pcgrand.next(); + return (float)uv / (float)U32_MAX; +} + int myrand_range(int min, int max) { return g_pcgrand.range(min, max); } +float myrand_range(float min, float max) +{ + return (max-min) * myrand_float() + min; +} + /* 64-bit unaligned version of MurmurHash |