#define SEED 1753 static unsigned long seed = SEED; static unsigned long call =1; unsigned long rand(void) { if ((seed % 2) > 0) { seed ^= call; seed >>= 1; seed |= 0x80000000; } else { seed ^= ~call; seed >>= 1; } call++; return seed; }