OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: StonedSoldier on 22 Jan 2004, 20:50:48
-
when using;
_rand = random 50
_num = _rand - (_rand2 mod 1)
the random number that is generated is between 0 - 60. is there a way to generate a random number between -10 and + 10.
-
OK, before i solve it for you, i'll give you the chance to solve
it yourself (*think simple math way*)
What would you need to to to change:
0 - 20
to:
-10 - 10
Now define your random result at a range: 0 - 20
and alter the result as you need to do in my math-riddle
above. ;)
:edit - ah yeah, btw - random 50 creates a number from
0 to 50, and not from 0 to 60
~S~ CD
-
errrrmmmm......still lost the plot,
could you give more detail please
-
OK then here we go:
if you want to alter a range from: 0 - 20
to: -10 - 10
all you need to do is: remove 10
create a random value between 0 and 20, and remove the
value of 10 from the result. Now you have a value from -10
to 10
~S~ CD
-
Try this:
_rand = (random 20) - 10
:beat: *Gets Shot* :beat:
EDIT: Crap, Chirs was faster... :P