Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Kinoko on Wed 14/07/2004 15:31:27

Title: SUGGESTION: Minimum/Maximum random number (SOLVED)
Post by: Kinoko on Wed 14/07/2004 15:31:27
I'm playing around with the Random() function and in a lot of cases, it'd be  much easier for me if there were a minimum parameter as well as a maximum parameter. I'm not sure why there isn't already, is there an obvious work around? Or is it just much more difficult to build into the function? Just wondered :)
Title: Re: SUGGESTION: Minimum/Maximum Random number
Post by: strazer on Wed 14/07/2004 15:53:43
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=14699
Title: Re: SUGGESTION: Minimum/Maximum Random number
Post by: Radiant on Wed 14/07/2004 15:54:01
function MyRandom (int min, int max) {
  return Random (max - min) + min;
}
Title: Re: SUGGESTION: Minimum/Maximum Random number
Post by: Kinoko on Wed 14/07/2004 16:00:52
D'oh. ^_^ Didn't see that... thanks.