I am looking for an algorithm to generate pseudo random numbers in a three (or better n) dimensional space of large extents. When initialized with a seed the generator should be able to repeatedly produce the same numbers for the same seed.
But unlike most generators available in programming languages, it should not just return the next random number in a sequence, but instead generate numbers for specific coordinates, no matter in what sequence the values are requested.
The size of the space should be regarded as too big to generate all the numbers at initialization time. In Java it could look something like this:
Random3D gen = new Random3D(seed);
int n1 = gen.getInt(3,0,6);
int n2 = gen.getInt(2,-3,1);
...
How would I do something like this?
I tried it in Java by writing some code using java.util.Random, but the quality of the results was not very good.
If you want to receive always the same result for the same coordenate, when you specify the seed, them you’re not looking for a true random generator.
You want a fast algorithm, a reliable one ? For a fast one, that a look at Mersenne twister. For a stronger one, you could look Blum Blum Shub.
You could use your n-dimensional coordinates, plus your seed, to generate the pseudo-random-number-generator. You could, for example, calculate the sha1 or md5 or any other hash of the coordinates + seed and use it in the PRNG.
Edit: for a simple solution, the math.random can receive a seed of 48 bits (smaller than the md5 output), which can be a bit small for your question (you mentionated to have high dimensionality, right? with larges coordinates?)