Jump to content
  • Advertisement
Sign in to follow this  
Telamon

Need a good random number generator

This topic is 4715 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'm writing a roguelike game in C# and while I'ven't really had many problems with System.Random, I'd feel better about it as an RNG if I knew what algorithm it was using. Since the RNG is pretty important in a roguelike, I thought I might try to find something that was very good in a proveable way (for any seed) and that was perhaps faster than System.Random.Next (seen some comparative benchmarks between Sys.Random and other RNGs and it's pretty slow). My thought was to grab some mersenne twister code in C and compile it to a DLL. For my perlin noise texture generator this gave me a huge speedup. But to be honest, I just like the name "Mersenne Twister". I don't really many RNG algorithms and don't know one that is better than another. So if I want a RNG that: Is fast Has a long period Has a balanced distribution Works well with any seed value Which one would be a good choice?

Share this post


Link to post
Share on other sites
Advertisement
I'm far from experienced in this area, but I've had sufficient success with this generator, and it seemed to work well according to the Diehard Battery of Tests of Randomness, if I remember correctly.

[edit]Seeing that there's a C# version of the Mersenne Twister, it'd probably be good to simply go with that.[/edit]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!