Lua is case sensitive. It has to be called like so:
Code:
rand = math.random(5)
or
Code:
rand = math.random(1, 5)