Is there a standard, cross platform number generator/algorithm/library that if seeded with the same input (in my case a hash of some sort), always produces the same set of pseudo-random numbers?
Ideally, I’d like to be able to do this cross platform, in both Java and .Net on any target machine, and get the same consistent output (vaguely random integers).
If it’s not possible, I’ll roll my own (my randomness requirements are very low, basically being used to assign different colors to something based on it’s ID – I just want to always assign the same color to the same item, no matter what system I’m running on).
There is a very simple and well known RNG algorithm, “Multiply-with-Carry”, that could be easily implemented on all platforms that I know of. It has the properties that you are requesting; it is up to you to decide whether it’s randomness would be adequate.
From Wikipedia:
And here is the dead-simple implementation in C#, which you will have no trouble adapting to other languages:
The initial values of m_w and m_z is the seed.