Better RNG

I've been trying to find a better random number generator than the built-in one. Many people have said that the Mersenne Twister is good, but I can't get it to work, either due to miscoding or something I need to download. If there's another one, or someone knows how to get it to work, please let me know.
boost has a random number generator library. You could try that. (It's also the one that's going into the next C++ standard so...)
The GMP library http://gmplib.org/ is simple to use and link against, and comes with a nice RNG.
closed account (1vRz3TCk)
I've been trying to find a better random number generator than the built-in one.

Better in what respect?
I assume distribution?
closed account (1vRz3TCk)
Also, what is the PRNG going to be used for?
closed account (DSLq5Di1)
Assuming you have a compiler that supports C++0x/TR1,

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>
#include <random>
using namespace std;

int main()
{
    random_device seed;
    mt19937 engine(seed()); // mersenne twister

    uniform_int_distribution<> dist(0, 100);
 
    for (int i = 0; i < 10; i++)
    {
        cout << dist(engine) << endl;
    }

    return 0;
}
Topic archived. No new replies allowed.