creating a list of unsorted numbers
i have an editbox in which i can enter a number between 1000-5000
and i need to create a list/array of unsorted numbers.
for e.g, if i enter 1500 in the box and click on the button 'Start'
it should create an array/list of numbers 1,2,3,....,1500 (but all mixed up)
any ideas guys?
Re: creating a list of unsorted numbers
Generate the list in order first. Then create a new blank list. Have another list that contains which spots are open. Generate a random number from 0 to the size of the last list mentioned and place the next number in the first list in it. Then remove that from the list of possibilities and generate again.
Re: creating a list of unsorted numbers
I think a more efficient way would be to check out
Collections.shuffle()