small refactor for mersenne twister