Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

kill

float Random(int seed1, int seed2, ..., int seedn);

This topic is 6106 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am working on implementing perlin noise in realtime, and I am looking for a function that will look something like the following: float Random(int seed1, int seed2, ..., int seedn); There is no need for the function to return actual perlin noise, I am looking for a uniform destribution, I will interpolate it afterwords. Another words, when passed N seeds the function returns a float. Any ideas on where I could get a function like this?

Share this post


Link to post
Share on other sites
Advertisement
Easiest way I can think of would be to combine your multiple seeds into a single seed and pass it through a typical uniform PRNG (such as linear congruential -- the typical srand/rand).

In combining the seeds, you''ll probably want to ensure it''s non-symmetric. For example, if N=2, then:
Random(3, 5)
is different than
Random(5, 3)

Using something similar to a CRC or MD5TAG on your seeds might prove useful in generating a new seed.

Of course, this reduces the amount of randomness you could possibly attain having N seeds, but for a quick fix, it should work.


---- --- -- -
Blue programmer needs food badly. Blue programmer is about to die!

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!