optimize number generation