Add warning concerning math.random portability

This commit is contained in:
Lars Müller 2024-01-17 22:37:55 +01:00 committed by GitHub
parent cf4192e8ac
commit 8abac46fe3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -58,6 +58,11 @@ make sure that both the upper & lower bound
as well as their difference are within the C `int` range - as well as their difference are within the C `int` range -
otherwise you may get overflows & errors. otherwise you may get overflows & errors.
WARNING: This is not portable; different builds on different platforms will produce different random numbers.
PUC Lua 5.1 builds use a system-provided random generator.
LuaJIT builds use LuaJIT's PRNG implementation.
Do not use `math.random` in mapgen, for example.
TIP: Use `math.random` as your go-to versatile "non-deterministic" random source. TIP: Use `math.random` as your go-to versatile "non-deterministic" random source.
== Random Number Generators == Random Number Generators