hmmer-3.3/easel/esl_random.c
/* mersenne_twister() and other mersenne_*() functions below:
 * A simple serial implementation of the original Mersenne Twister
 * algorithm [Matsumoto98]. 
 * 
 * There are more sophisticated and faster implementations of MT, using
 * vector instructions and/or directly generating IEEE754 doubles
 * bitwise rather than doing an expensive normalization. We can
 * improve the implementation later if necessary, but even the basic
 * MT offers ~10x speed improvement over Easel's previous RNG.
 * [SRE, 30 May 09, Stockholm]
 */
mersenne_twister() and other mersenne_*() functions below:
A simple serial implementation of the original Mersenne Twister
algorithm [Matsumoto98].

There are more sophisticated and faster implementations of MT, using
vector instructions and/or directly generating IEEE754 doubles
bitwise rather than doing an expensive normalization. We can
improve the implementation later if necessary, but even the basic
MT offers ~10x speed improvement over Easel's previous RNG.
[SRE, 30 May 09, Stockholm]
mersenne_twister () and other mersenne_ * () functions below : A simple serial implementation of the original Mersenne Twister algorithm [ Matsumoto98 ] . There are more sophisticated and faster implementations of MT using vector instructions and / or directly generating IEEE754 doubles bitwise rather than doing an expensive normalization . We can improve the implementation later if necessary but even the basic MT offers ~10x speed improvement over Easel ' s previous RNG . [ SRE 30 May 09 Stockholm ]
static uint32_t
mersenne_twister(ESL_RANDOMNESS *r)
{
  uint32_t x;
  if (r->mti >= 624) mersenne_fill_table(r);
  x = r->mt[r->mti++];
  x ^= (x >> 11);
  x ^= (x <<  7) & 0x9d2c5680;
  x ^= (x << 15) & 0xefc60000;
  x ^= (x >> 18);
  return x;
}
static uint32_t mersenne_twister ( ESL_RANDOMNESS * r ) { uint32_t x ; if ( r -> mti >= 624 ) mersenne_fill_table ( r ) ; x = r -> mt [ r -> mti ++ ] ; x ^= ( x >> 11 ) ; x ^= ( x << 7 ) & 0x9d2c5680 ; x ^= ( x << 15 ) & 0xefc60000 ; x ^= ( x >> 18 ) ; return x ; }
mersenne_twister() and other mersenne_*() functions below:
 A simple serial implementation of the original Mersenne Twister
 algorithm [Matsumoto98].
mersenne_twister () and other mersenne_ * () functions below : A simple serial implementation of the original Mersenne Twister algorithm [ Matsumoto98 ] .