refactored
refactored random numbers