fix random num generator