| Blockland Forums > Modification Help |
| Keeping decimals |
| (1/1) |
| Jasa 12265:
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? |
| Amade:
--- Quote from: Jasa 12265 on January 12, 2011, 09:21:23 PM ---Torque rounds all math to the nearest whole number. --- End quote --- 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:
Nvm, I found a better equation to fit the situation. |
| Space Guy:
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. |
| Navigation |
| Message Index |