Raihan Jamal wrote:Ok. Now it makes sense, So code should be something like the below after making changes If I need to generate unique random number between 0 and 1001?
No, because the limit in your code is 1000 (the rest, however, looks fine; if a bit tortuous).
What
exactly do you want to do?
Select ONE random number between 0/1-1000/1001; or get a list of
one thousand randomly-selected unique numbers between 1-1000?
If the last, your code looks quite close.
You might also want to look at the java.util.Random class.
Winston