Random
Random Obtain pseudo-random signed integer
#include <Quickdraw.h> Quickdraw
short Random( );
Random generates and returns a different pseudo-random number each time
it is called. The return value ranges from -32767 to 32767.
Returns: a signed integer; the next in a sequence of pseudo-random values,
uniformly distributed over the range -32767 to 32767.

Notes: To obtain a number within a selected range multiply the return value by
the range, divide by 65536, and add the desired minimum value. See the
Example, below.
The numbers are generated in a sequence based upon the starting, or "seed
value, which is stored in the global 32-bit variable randSeed.
The seed is initialized to 1 by InitGraf. If you start a sequence by storing
a value in randSeed, you can restart the same sequence by setting randSeed
to the same value. A more typical operation is to start the sequence with
some relatively unguessable value, such as the system time:
GetDateTime( &randSeed ); /* store 32-bit value in seed */
theRand = Random(); [TOKEN:12074] get a random number */
The Quickdraw global variable randSeed can also be used as a seed to start a
pseudo-random sequence.
Example
/* example function returns value between min and max */
#include <Quickdraw.h>
unsigned short RangedRdm( unsigned short min, unsigned short max )
/* assume that min is less than max */
{
unsigned qdRdm; /* treat return value as 0-65536 */
long range, t;
qdRdm = Random();
range = max - min;
t = (qdRdm * range) / 65536; /* now 0 <= t <= range */
return( t+min );
}