blockgame/mods/bg_api/util_random.lua
trans_soup a2ab91c992 fix math.random usage.
fix usage of `math.random` in various places to provide both a minimum
and a maximum number, instead of just maximum.

also renamed some files very slightly.
2023-10-13 13:17:14 +02:00

10 lines
247 B
Lua

local modname = minetest.get_current_modname()
function blockgame.chance (chance)
return math.random(1, chance) == 1
end
function blockgame.random_element (tab)
local keys = blockgame.get_keys(tab)
return tab[keys[math.random(1, #keys)]]
end