Genirate number and sort