// This function generates random integers depending on the arguments.
// If you supply one argument, it'll return a number between 1 and the provided number
// If you supply two arguments where the 2nd one is larger, it'll provide a number between the two
function RandNum ( start, end = 0 )
{
if ( !end ) { end = start; start = 1; }
return start + ( rand() % ( end - start + 1 ) );
}
Edit: Increased randomness of function thanks to Cutton