# HG changeset patch # User Wuzzy # Date 1704550236 0 # Node ID 5d951acf9b54eea8295a211e418f72314e52cf16 # Parent e7c3385d41a07e231aac8f1f7656e874f399aa4e LuaRules: Add math.random rule diff -r e7c3385d41a0 -r 5d951acf9b54 LuaRules.wiki --- a/LuaRules.wiki Wed Jun 28 22:18:50 2023 +0000 +++ b/LuaRules.wiki Sat Jan 06 14:10:36 2024 +0000 @@ -11,7 +11,8 @@ * If you want to divide by a different integer value, use the `div` function for integer division * Keep your numbers within ±253 * Avoid `math.floor` and `math.ceil` + * Never use `math.random` for gameplay-relevant numbers like setting the position, use `GetRandom` instead -These restrictions on numbers don't apply to numbers that you don't use for gameplay but for stuff like harmless eye candy. +These restrictions on numbers don’t apply to numbers that you don't use for gameplay but for stuff like harmless eye candy. For example, you can use `math.random` safely as long you don’t use the generated numbers for anything that affects gameplay. Failing to follow these rules might lead your script to behave differently on different systems, leading to desynchronization bugs, which means they will not work online.