void RandomSetSeed(unsigned int seed);
Initializes the random number generator to return a fixed random number sequence. If you use the same seed later, the same random numbers will be generated again. Consider using Randomize() instead for a variable random number sequence.
Parameters
seed Sets the starting point of a random number sequence. A seed of 12873, for example, will always be followed by the same sequence of pseudo random numbers. This is useful if you want a deck of cards re-dealt exactly the same way. Any positive integer value can be specified effectively creating billions of unique shuffles that are recallable using that same starting seed. Use Randomize() to get a more truly random number sequence.
Remarks
The RandomSetSeed() function initializes the random number generator to return a fixed random number sequence when the Random() function is called.
Availability
Available in DragonFireSDK 1.0 and later.
Example Description: This example will generate the same series of random numbers each time it is called.
#include "DragonFireSDK.h" #include <time.h>
void AppMain() { int i; int n;
RandomSetSeed(time(NULL)); for (i = 0; i < 52; i++) { n = Random(52); // 52 specifies that the number returned should be between 0-51 printf("%d ", n); } }
void AppExit() {
}
void OnTimer() {
} |