#define MULTIPLIER 0x41c64e6dL #define INCREMENT 12345 int rand() { _seed = MULTIPLIER * _seed + INCREMENT; return ((int)(_seed >> 16) & 0x7FFF); }
See also : srand