Instead of "Randomize", think "Shuffle":
void Shuffle<T>(IList<T> items)
{
// creating a new object here for demo purposes
// Really, the same object should be re-used across method calls
var random = new Random();
for (int i = items.Count; i > 1; i--)
{
// Pick random element to swap.
int j = random.Next(i); // 0 <= j <= i-1
// Swap.
T tmp = items[j];
items[j] = items[i - 1];
items[i - 1] = tmp;
}
}
The Windows Forms textbox has a helpful Lines
property to make this easy to use:
string[] lines = MyTextBox.Lines;
Shuffle(lines);