Your question is somewhat vague. You seem to be asking for a hashing function, but you are talking about random numbers. Why do they have to be random but reproducible?
–
bdaresMay 24 '11 at 7:32

1

I'm planning to use it for procedural generation. So I need to generate a random component for a coordinate, but I need it to be the same result each time for that coordinate as long as the generator uses the same master seed.
–
Jo-Herman HaugholtMay 24 '11 at 7:39

4 Answers
4

There's plenty of space for that kind of population with good ole MD5 (128 bit output).

You can just take the lowest 32 bits for an integer if that's the kind of output you need. Really, any sort of hashing algorithm that has an output space at least as large as an int will do.

Now, you can do all sorts of fun stuff if you're paranoid. Start with a hash of your coordinates, then feed the result into a secure random number generator (java.security.SecureRandom). Then hash it 1000 times with a salt that's your birthday concatenated (x+y) times.

Joking aside, random number generators don't necessarily have wildly varying results based on small variations of the seed. They're designed to have a really, super duper long chain of generated numbers before they start repeating, while having those chains pretty evenly distributed among the number space.

On the other hand, the SecureRandom is designed to have the additional feature of being chaotic in regard to the seed.

The visualization is a render of the the coordinates [0..2),[0..2) with 128:1 points. For actual implementation, I'm looking at arbitrary coordinates in a much larger coordinate set, and varying amount of points.
–
Jo-Herman HaugholtMay 24 '11 at 9:15

Well, even if you're looking at a space that's larger than 2^128, a hash will serve pretty well, as it's larger than normal integers already.
–
bdaresMay 25 '11 at 0:11

Most languages have a PRNG package (or two) that lets you initialize the generator with a specific seed. PRNGs can also often be found as part of a larger cryptographic package; they tend to be a bit stronger than those found in general-purpose libraries.

That's disturbing. What happens if you reorganize your script to generate a single Random object and use it to fill the image by calling next(8) for each pixel? Assuming that it behaves more randomly, the only thing I can suggest is to look at using java.security.SecureRandom instead of java.util.Random.
–
Ted HoppMay 24 '11 at 16:47

the call to drand# gives you random numbers from 0 to 1 simply multiply that by your needed range for each vector needed p2$ is the password that is passed to the password handler which combines it with some other random characters and then caps the size to a certain limit p1$ is where the final modified password is contained
drand# itself calls another sub which is actually a clone of itself with some shuffling of
sorts that works to ensure that the numbers being produced are truly random there is also a table of values that are added in to the values being added all this in total makes the RNG many many more times random with than without.

this RNG has a very high sensitivity to slight differences in password initially set you must however make an intial call to setup and initialize to "bootstrap" the random number generator this RNG will produce Truly random numbers that will pass all tests of randomness
more random even then shuffling a deck of cards by hand , more random than rolling a dice..
hope this helps using the same password will result in the same sequnece of vectors

This program would have to be modified a bit though to pick random vectors rather than
it's current use as a secure encryption random number generator...

You can use encryption for this task, for example AES. Use your seed as the password, struct with coordinates as the data block and encrypt it. The encrypted block will be your random number (you can actually use any part of it). This approach is used in the Fortuna PRNG. The same approach can be used for disk encryption where random access of data is needed (see Random access encryption with AES In Counter mode using Fortuna PRNG:)