a2ab91c992
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.
10 lines
247 B
Lua
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
|