added functional generate number with callback function