Whats the quickest way to generate a list of consecutive numbers in a random order?
i.e. generate a list of numbers from 1 to 100, the list must contain each number once only. The order of the list should be random.
java or c# please.
my pseudocode looks like this, very inefficient.
var list = new list<int>();
for (int i = 1; i <= 100; ++i) {
int x;
repeat {
x = random(1, 100);
until (list.contains(x) == false);
list.add(x);
}