a mash-up of interests and activities, including web development, music, design, and pittsburgh life
I get a lot of requests for random ordering at my job... this helps a lot.
(from s in myset orderby Guid.NewGuid() select s).Take(5)
I tend to take the route of (from s in myset orderby Guid.NewGuid() select s).Take(5)I am on my cell atm, but it looks like yours could tentatively skip to the last element, therefore only being able to take 1 item.
hmmm. i think you're right! i'll have to change it. didn't know you could do that guid trick to be honest... thanks for bringing it up. where were you a year ago to help me with this then? ;)
This query is useful for random func against datatablevar result2 = (from result in dt.AsEnumerable().OrderBy( result => Guid.NewGuid()) select result).Take(3) ;