16 Nov, 2009, Lobotomy wrote in the 1st comment:
Votes: 0
Simply put, I'm looking for suggestions for which implementation of Mersenne Twister I should use for my C++ project as its primary PRNG. There's quite a few listed on the MT's website, so I'm not sure which one I should go with. I'm also not sure if there is even any real need to use a C++ implementation since I could just use one of the C implementations instead (and I have code from a prior project that I could reuse). One C++ implementation I'm looking into at the moment is this one which has a version as recent as September of this year.
16 Nov, 2009, David Haley wrote in the 2nd comment:
Votes: 0
Why do you need a C++ implementation as opposed to a C implementation? Are you just trying to put a C++ interface on it? If you already have a working C implementation, I would just go with that, and if you want a C++ interface, it would be very easy to wrap it without reimplementing any of the algorithm.
16 Nov, 2009, Lobotomy wrote in the 3rd comment:
Votes: 0
David Haley said:
Why do you need a C++ implementation as opposed to a C implementation?

That's part of what I'm asking. I see C++ implementations listed on their site, so I'm wondering what the merit is.

David Haley said:
Are you just trying to put a C++ interface on it?

Not particularly, no. I'm more concerned about the quality and speed of the implementation than the interface.

David Haley said:
If you already have a working C implementation, I would just go with that, and if you want a C++ interface, it would be very easy to wrap it without reimplementing any of the algorithm.

Right, but I figured I'd at least see if there's something better to use before going ahead with that.
16 Nov, 2009, David Haley wrote in the 4th comment:
Votes: 0
A C++ implementation might encapsulate its data more than a C implementation, unless the C programmers did their job correctly and used structures for state instead of global variables.

Performance will be determined by the quality of the programmers, and not C vs. C++. Similar story for quality of the algorithm itself.
30 Nov, 2009, Silenus wrote in the 5th comment:
Votes: 0
Sorry for pulling up an old thread- but I actually looked into this a bit also since I was looking for a prng to pair with a brownian dynamics simulator I was working on. Eventually I went with the stuff in the gnu scientific library which included the very fast ziggurat transformation to the normal distribution. However perhaps the SIMD implementation might be very fast on x86 which is listed on top of the page. I didnt get around to testing it but I suspect from the description it might be faster than a non-SIMD done in straight C.
0.0/5