I noticed in the comments you wanted no repeats, so you want the numbers to be 'shuffled' similar to a deck of cards.
I would use a List<>
for the source items, grab them at random and push them to a Stack<>
to create the deck of numbers.
Here is an example:
private static Stack<T> CreateShuffledDeck<T>(IEnumerable<T> values)
{
var rand = new Random();
var list = new List<T>(values);
var stack = new Stack<T>();
while(list.Count > 0)
{
// Get the next item at random.
var index = rand.Next(0, list.Count);
var item = list[index];
// Remove the item from the list and push it to the top of the deck.
list.RemoveAt(index);
stack.Push(item);
}
return stack;
}
So then:
var numbers = new int[] {0, 1, 4, 6, 8, 2};
var deck = CreateShuffledDeck(numbers);
while(deck.Count > 0)
{
var number = deck.Pop();
Console.WriteLine(number.ToString());
}