How to randomly shuffle a List<T> in C#?
Hello everyone! I'm new to C# and writing a small card game application. I have a list (List) that contains a deck of cards. I need to shuffle these cards randomly before dealing, but I can't find a built-in method like List.Shuffle().\n\nHere's my code:\n\n```csharp\nList deck = new List();\n// ... filling the deck with cards ...\n\n// How to shuffle now? I tried:\ndeck.OrderBy(x => random.Next()).ToList(); // But this returns a new list, not modifying the original\n```\n\nThe problem is that I want to modify the original deck list, not create a new one. Also, I've read that using Random with OrderBy can produce uneven distribution or even exceptions if random.Next() returns the same values for multiple elements.\n\nPlease advise,