Is there a way to return a random row from a table using LINQToSQL?
I'd try something like:
query.Skip(rand.Next()).Take(1).FirstOrDefault();
With rand
being initialised as returning a number between a specific range.
Be sure to check for null as the return value in case the random number generated was greater than the number of rows (of course you could initialise it's upper bound as the number of rows, too).