Functions |
|
void | RpRandomSeedMT (RwUInt32 seed) |
RwUInt32 | RpRandomMT (void) |
void | RpRandomSeed (RwUInt32 seed) |
RwUInt32 | RpRandom (void) |
RwBool | RpRandomPluginAttach (void) |
It is provided as a RenderWare Graphics Plugin as a replacement for generators used in the standard C libraries. This allows consistent random number generation across all our supported platforms.
|
RpRandom is used to generate a 31-bit pseudo-random number. It uses a non-linear additive feedback random number generator employing a default table of size 31 long integers to return successive pseudo-random numbers in the range 0 to pow(2,31)-1. The period of this random number generator is very large, approximately 16(pow(2,31)-1). Note that all the bits generated by RpRandom are usable, for example RpRandom() &01 will produce a random binary value. The random number plugin must be attached before using this function.
|
|
RpRandomMT is used to generate ``Mersenne Twister'' (MT19937) random numbers. The Mersenne Twister generator produces pseudorandom integers uniformly distributed in 0..(2^32 - 1) starting from any odd seed in 0..(2^32 - 1). According to the URL <http://www.math.keio.ac.jp/~matumoto/emt.html> (and paraphrasing a bit in places), the Mersenne Twister is ``designed with consideration of the flaws of various existing generators,'' has a period of 2^19937 - 1, gives a sequence that is 623-dimensionally equidistributed, and ``has passed many stringent tests, including the die-hard test of G. Marsaglia and the load test of P. Hellekalek and S. Wegenkittl.'' It is efficient in memory usage (typically using 2506 to 5012 bytes of static data, depending on data type sizes, and the code is quite short as well). It generates random numbers in batches of 624 at a time, so the caching and pipelining of modern systems is exploited. It is also divide- and mod- free. The random number plugin must be attached before using this function.
|
|
RpRandomPluginAttach is used to attach the random number plugin to the RenderWare system to enable the generation of random integer values. The random plugin must be attached between initializing the system with RwEngineInit and opening it with RwEngineOpen. Note that the include file rprandom.h is required and must be included by an application wishing to use random numbers. The random plugin library is contained in the file rprandom.lib The call to this function should occur after RwEngineInit.
|
|
RpRandomSeed is used to initialize the random number generator using the specified seed value. Note that this function does not return the old seed. Therefore, if it is required to reproduce a sequence of random numbers, the seed must be set with a user-defined value before any numbers are generated. The seed can then be used again to generate the same numbers. The random number plugin must be attached before using this function.
|
|
RpRandomSeedMT is used to initialize the Mersenne Twister random number generator using the specified seed value. Note that this function does not return the old seed. Therefore, if it is required to reproduce a sequence of random numbers, the seed must be set with a user-defined value before any numbers are generated. The seed can then be used again to generate the same numbers. The random number plugin must be attached before using this function.
|
Converted from CHM to HTML with chm2web Pro 2.85 (unicode) |