Jump to content
Sign in to follow this  
tophe

Random specific numbers

Recommended Posts

I want to do a variable that has to have a number between 175580 and 175591.

But the command Random always start at 0.

I would like something like X = RANDOM 175580 to 175591

I hope you understand my point.

How could I do this?

Share this post


Link to post
Share on other sites

_x1 = 175580;

_x2 = 175591;

_number = floor random (_x2-_x1+1) + _x1;

or

_number = floor random (175591-175580+1) + 175580;

Share this post


Link to post
Share on other sites

Thanks guys!

It seems to me that

(RANDOM 11) + 175580

is pretty much the same as

_number = floor random (_x2-_x1+1) + _x1;

Or maybe

_number = floor random (175591-175580+1) + 175580;

could be written

_number = floor random (12) + 175580;

Anyway. You helped alot. Now I can use this for randomizing

a destroyed fence in a camp. Or to exclude certain buildingpositions when randomizing where to put units.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×