Fix data race in mersenne twister implementation