Shuffle lines in a file in .NET

c#, file

Solution

var lines = File.ReadAllLines("test.txt");
var rnd = new Random();
lines = lines.OrderBy(line => rnd.Next()).ToArray();
File.WriteAllLines("test.txt", lines);

Problem

Consider I have a file "new.txt" like, ``` asdfg qwerty zcx poi ``` Now i need to shuffle the lines of this text file. How can i do this in C#.?

Original source