Select N Random Records with Linq
linq-to-sql
Solution
Maybe something like this would work:
int randomSkip;
int randomTake;
randomSkip = GenerateSomeAppropriateRandomNumber();
randomTake = GenerateSomeAppropriateRandomNumber();
resultSet = iEnumerable.Skip(randomSkip).Take(randomTake);
Problem
I have a static table with 20+ records, I would like to select N (N<20) from that table in random manner. What is the best way to do it in the code with LINQ?