Fix mt_rand off-by-one error.