fix random number gen