Compare C++ Standard Library's Mersenne Twister with Mathematica's Mersenne Twister

The C++ standard library does contain a set of random distribution classes, among other things a Mersenne Twister engine.

What I'd like to do is to generate the same random number distribution, using the same seed for C++ and Mathematica.

For instance, generate 10 random numbers using the mersenne twister engine (C++):

std::vector<size_t> a1( 10 );
std::mt19937 gen(42);
std::generate(a1.begin(), a1.end(), gen);

/* {1608637542, 3421126067, 4083286876, 787846414, 3143890026, 3348747335,
2571218620, 2563451924, 670094950, 1914837113} */


and now I generate 10 random integers in Mathematica using the MersenneTwister engine:

BlockRandom[SeedRandom[42, Method -> "MersenneTwister"]
RandomInteger[{0, 2^32 - 1}, 10]]

(* {3012359023, 1649004928, 188383571, 1935467488, 3494372723, 668236121,
1292572136, 98984411, 2487091843, 3121826951} *)


Apparently not the same. The mersenne twister in the C++ standard library uses the following default settings to generate the distribution:

The question is now: How much influence do I have on Mathematica's random number generator, so that I can overwrite some specific settings to generate the same set of numbers for a given seed?

The .tm file:

:Begin:
:Function:      mersenneRange
:Pattern:       MT19937Range[seed_, len_]
:Arguments:     { seed, len }
:ArgumentTypes: { Integer, LongInteger }
:ReturnType:    Manual
:End:

:Evaluate:      MT19937Range::usage = ""


The .cpp file:

#include <random>

using namespace std;

void mersenneRange( int seed, long length )
{
mt19937 gen(seed);

for(long x = 1; x <= length; x++)
}


MLPutFunction expects as a third argument a int. So implicit conversion here with loss of precision. Is there a better alternative?

The Mathematica side:

link = Install["wherever the binary is...",  LinkMode -> Launch]

MT19937Range[42, 10]

(* {1608637542, 3421126067, 4083286876, 787846414, 3143890026, 3348747335, 2571218620,
2563451924, 670094950, 1914837113} *)


-
Yes @OleksandrR my fault. Was a typo... –  Stefan Feb 13 '13 at 15:16
You can define your own random number generation method for Mathematica, see tpfto.wordpress.com/2012/02/12/… for an example. The docs describe the API to do this. You can write a LibraryLink function which calls your C++'s RNG. –  Szabolcs Feb 13 '13 at 19:15
See here for the three different Mersenne twister implementations Mathematica includes, and also for defining your own custom RNG method. –  Szabolcs Feb 13 '13 at 19:18
@Szabolcs thank you for the links. At the moment I'm writing on a skeleton implementation for integration into the RNG framework. But, nevertheless, this wasn't the question. The mt19937 is well defined and I just want to know what parameter values the folks at wolfram are using and if I can change them...like option values. The values I've listed are just parameter values for the typedef in the C++ standard library. –  Stefan Feb 13 '13 at 19:38
@Stefan Are you sure it wouldn't also depend on hardware parameters, e.g. the size of a machine integer? You might not have control over this in Mathematica, so just using the C++ generator may be better ... I think the most complete docs on RNG methods is what I linked. It doesn't describe suboptions for MersenneTwister there, but there may be some undocumented ones. I'd just write to support and ask about it. They may be slow to reply, but they're pretty good at providing this type of information. If there are suboptions, they'll let you know. –  Szabolcs Feb 13 '13 at 19:42