final random number generator