Sign in to follow this  
Telamon

Need a good random number generator

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this