Author Topic: Keeping decimals  (Read 722 times)

Torque rounds all math to the nearest whole number. If %amount were equal to 800 in echo(getrandom(1,(1000/%amount))); how would I get it to choose a random number between 1 and 1.25 that were a decimal?

Torque rounds all math to the nearest whole number.
no it doesn't

if you want a random decimal between 0 and 1 use getrandom() with no args. if you want it between 0 and 0.25 then it's just getrandom()/4 and you can just add that to a random number to do what you're trying to do.

Nvm, I found a better equation to fit the situation.

getRandom() returns a random decimal 0 - 1
getRandom(%a, %b) returns a random integer between those two numbers

Try e.g. 1 + (getRandom()*1000/%amount) for that.