int seed = 0x0f0f0f0f;
//! generates a pseudo random number
int rand()
{
const int m = 2147483399; // a non-Mersenne prime
const int a = 40692; // another spectral success story
const int q = m/a;
const int r = m%a; // again less than q
seed = a * (seed%q) - r* (seed/q);
if (seed<0) seed += m; return seed; }
//! generates a pseudo random number
int rand()
{
const int m = 2147483399; // a non-Mersenne prime
const int a = 40692; // another spectral success story
const int q = m/a;
const int r = m%a; // again less than q
seed = a * (seed%q) - r* (seed/q);
if (seed<0) seed += m; return seed; }
沒有留言:
張貼留言