Jump to content
Sign in to follow this  
falconx1

random numbers

Recommended Posts

was wondering what the ranges are gonna be exactly?

im trying to make AI spawn between like min 7.1 - 17 seconds max

so game play stay less predictable

s will be changed to sleep tho but just asking?

s = (7.1+random(9.8));

Share this post


Link to post
Share on other sites

You cant get it that precise.

I would go for:

_randomNum = random(10)+7.1;

Share this post


Link to post
Share on other sites

s = (7.1+random(9.8));

would give you 7.10000 > 16.89999

min = 7.1;
max = 17;
s = ((random max - min) + min);

would give 7.10000 > 16.99999

As per WIKI

The sleep precision is given by framerate, the delay given is the minimal delay expected.

Share this post


Link to post
Share on other sites

cool thanks, yea the numbers are pretty close i think any of these will do thanks!

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  

×