If you don't want to keep picking the same random number, store them in a Set. Then check for each random number whether the set contains that number.
Random rand = new Random();
Set<Integer>...
Type: Posts; User: copeg
If you don't want to keep picking the same random number, store them in a Set. Then check for each random number whether the set contains that number.
Random rand = new Random();
Set<Integer>...