<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Jonathon Bolster &#187; linq</title>
	<atom:link href="http://www.bolsterweb.com/tag/linq/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bolsterweb.com</link>
	<description>Programming, drawing, random, life.</description>
	<lastBuildDate>Mon, 03 Oct 2011 17:30:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Random sort on IEnumerable object</title>
		<link>http://www.bolsterweb.com/2010/05/random-sort-on-ienumerable-object/</link>
		<comments>http://www.bolsterweb.com/2010/05/random-sort-on-ienumerable-object/#comments</comments>
		<pubDate>Sat, 15 May 2010 12:25:14 +0000</pubDate>
		<dc:creator>Jonathon Bolster</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[dotnet]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[linq]]></category>

		<guid isPermaLink="false">http://www.bolsterweb.com/?p=93</guid>
		<description><![CDATA[Quick extension on an IEnumerable object to return the collection in a random order: For example, to return a random set of 5 items from the collection: If anyone knows of a better way, let me know]]></description>
			<content:encoded><![CDATA[<p>Quick extension on an IEnumerable object to return the collection in a random order:</p>
<pre class="brush: csharp; title: ; notranslate">
public static IEnumerable&lt;T&gt; Random&lt;T&gt;(this IEnumerable&lt;T&gt; source)
{
	return source.OrderBy(x =&gt; Guid.NewGuid());
}
</pre>
<p>For example, to return a random set of 5 items from the collection:</p>
<pre class="brush: csharp; title: ; notranslate">
var randomSet = myEnumerable.Random().Take(5);
</pre>
<p>If anyone knows of a better way, let me know <img src='http://www.bolsterweb.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.bolsterweb.com/2010/05/random-sort-on-ienumerable-object/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

