shape:setY(math.random(0, 450 - 50))
math.random function with a minimum and a maximum value is what I understand but what exactly is the meaning of using arithmetic operator in mat.random function, say in above LOC, why is it 450 - 50 and not 400? what is the difference?
similarly,
self:setPosition(540, math.random(160) + 40)
There is no difference. It is equivalent to shape:setY(math.random(0, 400))
.
The second line of code is equivalent to the following:
self:setPosition(540, math.random(1, 160) + 40)
It is most certainly intended to be a clearer and/or simpler way of writing
self:setPosition(540, math.random(41, 200))
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments