Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Environment and Utilities /
Chapter 8 - QuickDraw GX Mathematics / QuickDraw GX Mathematics Reference
Mathematical Functions / Random Number Generation


SetRandomSeed

You can use the SetRandomSeed function to set the starting number for the random number generator algorithm.

void SetRandomSeed(const wide *seed);
seed
The pointer to the number to be used by the random number algorithm to generate random numbers.
DESCRIPTION
Random number generators are seeded with a value that is used by the algorithm to generate a random number. The seed is then used to generate the next random number.

The SetRandomSeed function allows you to select the seed used by the QuickDraw GX random number algorithm. If SetRandomSeed is not used, QuickDraw GX will select a default seed of 0. This results in the same sequence of random numbers each time RandomBits is called.

In order to obtain a different set of random numbers than those obtained using the default seed value or a previously set seed, use the SetRandomSeed function.

SEE ALSO
The RandomBits function uses the current seed to generate the next random number. The RandomBits function is described on page 8-58. The GetRandomSeed function returns the current seed. The GetRandomSeed function is described next.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996