Mersenne Twister (mt19937ar.c) not returning random number
<p>I tried searching for examples on how to use the <a href="http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/CODES/mt19937ar.c" rel="nofollow noreferrer">mt19937ar.c</a> variant of <strong>Mersenne Twister</strong> but most come up in <strong>C++</strong> and <a href="https://stackoverflow.com/questions/18550656/how-to-implement-mersenne-twister-random-number-generation-in-c">others seem to use <code>mtwist.h</code></a>. </p>

<p>My code below:</p>

<pre><code>int getRandomNum(void)
{
    int i;
    i = (int) genrand_int32();
    return i;
}

int main(int argc, char **argv)
{
    ...
    int m = getRandomNum();
    printf("m = %d", m);
    ...
    return 0;
}
</code></pre>

<p>simply spits out the same integer over and over again. Seems like a seeding issue, but every implementation that I've found of getting a random number with <code>mt19937</code> simply just invokes <code>genrand_int32()</code>. Am I doing this incorrectly? </p>