Let\'s say I have a DataTable with ~50 rows (GetDataTable() on a list in SharePoint). I want to keep 10 random rows and forget about the rest. How can I achieve this?
You can use a Fisher/Yates shuffle (implementation by Skeet) on the collection of rows on the DataTable, then select the first 10.
var random10 = dataTable.Rows.OfType().Shuffle(new Random()).Take(10);