So effectively I want this:
int randomNumber = RandomGenerator(double x);
and preferably I can do even this:
int randomNumber = RandomGenerator(double x, double y, double z, double u, double v);
(Because yes, I need a 5 dimensional Perlin noise.)
Right, if I understand correctly (which I might not), how about:
Use standard PRNG mechanism to get a seed number for each 'dimension' and (as I sort of mentioned in the previous message) for which you maintain separate PRNG streams. That way, each stream is identical in each instance, regardless of which other (or how many other) streams have been tapped. You can add a sixth call for a sixth dimension's seed and start
that stream up without affecting the previous five streams-worth of randomness, and without having to generate a sixth column to a table.
And if you want a random-access randomness stream, the streams could each be a variant of "randomnumber(streamseed,Nthposition" where it calls the
first random number from a stream based upon the seed "streamseed+Nthposition", and you can then forget about any further numbers in that stream. Perhaps worse w.r.t. entropy (I'd be tempted to do something more complex, maybe hash the two values in some way) but, with a decent algorithm behind it, even that simple method won't be easily separated from noise, and yet gives you the
same numbers for 1st, 2nd and 3rd position, even if you ask for them in order of 3rd, 2nd and 1st, and interspaced by alternate stream calls.
To that end, maybe your call could be "randomnumber(streamnumber,positionnumber)" and boil down to "seed with(fn(streamnumber,positionnumber)); return firstrandomnumber". It would save the table, although you might want to statistically analyse an initial run to check there's no obvious problems. The periodicity should
probably be the same as your integrated randomness function, i.e.
huge, but that's not guaranteed.
In light of those last two (three) ninjas... Huh? I thought he
did want identical/reproducible sets, just didn't know which separate dimensions would be requested each time, so couldn't be a single reproducible stream. If not that, then ignore the above. Probably best in the first place, actually.