Blockland Forums
Home
Help
Login
Register
Blockland Forums
»
Blockland Forums
»
Modification Help
»
Keeping decimals
« previous
next »
Print
Pages: [
1
]
Author
Topic: Keeping decimals (Read 722 times)
Jasa 12265
January 12, 2011, 09:21:23 PM
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?
Ad Bot
Advertisement
Amade
January 13, 2011, 12:45:27 AM
Quote from: Jasa 12265 on January 12, 2011, 09:21:23 PM
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.
Jasa 12265
January 13, 2011, 05:54:34 PM
Nvm, I found a better equation to fit the situation.
Space Guy
January 15, 2011, 06:51:18 PM
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.
Print
Pages: [
1
]
« previous
next »
Blockland Forums
»
Blockland Forums
»
Modification Help
»
Keeping decimals