Linq Orderby random ThreadSafe for use in ASP.NET
One way to achieve efficiently is to add a column to your data Shuffle that is populated with a random int (as each record is created). The query to access the table then becomes … Random random = new Random(); int seed = random.Next(); result = result.OrderBy(s => (~(s.Shuffle & seed)) & (s.Shuffle | seed)); … Read more