ISO C Random
This algorithm generates a random number.
public static int ISOCRandom(uint seed)
{
uint next = seed;
int result;
next *= 1103515245;
next += 12345;
result = (int)((uint)(next / 65536) % 2048);
next *= 1103515245;
next += 12345;
result <<= 10;
result ^= (int)((uint)(next / 65536) % 1024);
next *= 1103515245;
next += 12345;
result <<= 10;
result ^= (int)((uint)(next / 65536) % 1024);
seed = next;
return result;
}
Example
int value = ISOCRandom((uint)DateTime.Now.Millisecond);
Output
1798100440