[Resolved] Math.random and decimals

Hi, im working with math operations and i need to change a value with a random number but im having a problem.
[lua]local speed = (-1.2)
local function speedChange()
speed = math.random(-2.5,-1.2)
end[/lua]
If I use that function, speed changes succesfuly but the problem is that it just dont read the decimals, speed change to -2 or -1, wich is a problem because there is a lot of difference between -1.2 and 1.8 in my current proyect.

Thanks in advance. [import]uid: 108461 topic_id: 31677 reply_id: 331677[/import]

Try:
[lua]speed = math.random ( -25, -12 ) / 10[/lua]

And here is Corona’s page on math.random:
http://docs.coronalabs.com/api/library/math/random.html
[import]uid: 7721 topic_id: 31677 reply_id: 126522[/import]

Oh right so dumb of me.

Thanks for the workaround ETdoFresh [import]uid: 108461 topic_id: 31677 reply_id: 126526[/import]

Try:
[lua]speed = math.random ( -25, -12 ) / 10[/lua]

And here is Corona’s page on math.random:
http://docs.coronalabs.com/api/library/math/random.html
[import]uid: 7721 topic_id: 31677 reply_id: 126522[/import]

Oh right so dumb of me.

Thanks for the workaround ETdoFresh [import]uid: 108461 topic_id: 31677 reply_id: 126526[/import]