<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Ruby golf; generating random strings</title>
	<atom:link href="http://coderrr.wordpress.com/2008/10/28/ruby-golf-generating-random-strings/feed/" rel="self" type="application/rss+xml" />
	<link>http://coderrr.wordpress.com/2008/10/28/ruby-golf-generating-random-strings/</link>
	<description>pronounced &#34;coder&#34; not &#34;code err&#34; (extended r optional)</description>
	<lastBuildDate>Sun, 20 Dec 2009 10:03:37 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: coderrr</title>
		<link>http://coderrr.wordpress.com/2008/10/28/ruby-golf-generating-random-strings/#comment-1246</link>
		<dc:creator>coderrr</dc:creator>
		<pubDate>Thu, 19 Feb 2009 20:13:29 +0000</pubDate>
		<guid isPermaLink="false">http://coderrr.wordpress.com/?p=201#comment-1246</guid>
		<description>yea good point mina, i missed that yours will always give 10</description>
		<content:encoded><![CDATA[<p>yea good point mina, i missed that yours will always give 10</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mina Naguib</title>
		<link>http://coderrr.wordpress.com/2008/10/28/ruby-golf-generating-random-strings/#comment-1232</link>
		<dc:creator>Mina Naguib</dc:creator>
		<pubDate>Tue, 10 Feb 2009 18:54:38 +0000</pubDate>
		<guid isPermaLink="false">http://coderrr.wordpress.com/?p=201#comment-1232</guid>
		<description>@coderr

Hmm. True.  I guess that essentially makes my version the same as sepp2k&#039;s, but meeting the 10-character requirement.</description>
		<content:encoded><![CDATA[<p>@coderr</p>
<p>Hmm. True.  I guess that essentially makes my version the same as sepp2k&#8217;s, but meeting the 10-character requirement.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: coderrr</title>
		<link>http://coderrr.wordpress.com/2008/10/28/ruby-golf-generating-random-strings/#comment-1231</link>
		<dc:creator>coderrr</dc:creator>
		<pubDate>Tue, 10 Feb 2009 17:38:44 +0000</pubDate>
		<guid isPermaLink="false">http://coderrr.wordpress.com/?p=201#comment-1231</guid>
		<description>@mina

see http://coderrr.wordpress.com/2008/10/28/ruby-golf-generating-random-strings/#comment-809</description>
		<content:encoded><![CDATA[<p>@mina</p>
<p>see <a href="http://coderrr.wordpress.com/2008/10/28/ruby-golf-generating-random-strings/#comment-809" rel="nofollow">http://coderrr.wordpress.com/2008/10/28/ruby-golf-generating-random-strings/#comment-809</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mina Naguib</title>
		<link>http://coderrr.wordpress.com/2008/10/28/ruby-golf-generating-random-strings/#comment-1230</link>
		<dc:creator>Mina Naguib</dc:creator>
		<pubDate>Tue, 10 Feb 2009 17:32:32 +0000</pubDate>
		<guid isPermaLink="false">http://coderrr.wordpress.com/?p=201#comment-1230</guid>
		<description>Here&#039;s another vector, revolving around the fact that Integer#to_s accepts a base.

This clocks in at 34 characters, and does not do upper case, but might inspire some:

i=(x=36)**9;(rand(i*x-i)+i).to_s x</description>
		<content:encoded><![CDATA[<p>Here&#8217;s another vector, revolving around the fact that Integer#to_s accepts a base.</p>
<p>This clocks in at 34 characters, and does not do upper case, but might inspire some:</p>
<p>i=(x=36)**9;(rand(i*x-i)+i).to_s x</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: PeterFairfield</title>
		<link>http://coderrr.wordpress.com/2008/10/28/ruby-golf-generating-random-strings/#comment-1228</link>
		<dc:creator>PeterFairfield</dc:creator>
		<pubDate>Mon, 09 Feb 2009 20:29:34 +0000</pubDate>
		<guid isPermaLink="false">http://coderrr.wordpress.com/?p=201#comment-1228</guid>
		<description>rand&gt;0.5 would make it one less, but I really need to get rid of the ternary altogether.</description>
		<content:encoded><![CDATA[<p>rand&gt;0.5 would make it one less, but I really need to get rid of the ternary altogether.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: PeterFairfield</title>
		<link>http://coderrr.wordpress.com/2008/10/28/ruby-golf-generating-random-strings/#comment-1227</link>
		<dc:creator>PeterFairfield</dc:creator>
		<pubDate>Mon, 09 Feb 2009 20:20:44 +0000</pubDate>
		<guid isPermaLink="false">http://coderrr.wordpress.com/?p=201#comment-1227</guid>
		<description>Jeffmo brought this to work, and then helped me with this one. 

36. 

(&quot;%#{rand(2)&gt;0?&#039;x&#039;:&#039;X&#039;}&quot;%srand)[9,4]

I&#039;m sure it can be improved upon...</description>
		<content:encoded><![CDATA[<p>Jeffmo brought this to work, and then helped me with this one. </p>
<p>36. </p>
<p>(&#8220;%#{rand(2)&gt;0?&#8217;x':&#8217;X'}&#8221;%srand)[9,4]</p>
<p>I&#8217;m sure it can be improved upon&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Magnus Holm</title>
		<link>http://coderrr.wordpress.com/2008/10/28/ruby-golf-generating-random-strings/#comment-1225</link>
		<dc:creator>Magnus Holm</dc:creator>
		<pubDate>Sun, 08 Feb 2009 19:10:07 +0000</pubDate>
		<guid isPermaLink="false">http://coderrr.wordpress.com/?p=201#comment-1225</guid>
		<description>This is getting extreme!

Collaborative golfing is so much funnier than competitive (aka codegolf.com)!</description>
		<content:encoded><![CDATA[<p>This is getting extreme!</p>
<p>Collaborative golfing is so much funnier than competitive (aka codegolf.com)!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: coderrr</title>
		<link>http://coderrr.wordpress.com/2008/10/28/ruby-golf-generating-random-strings/#comment-1224</link>
		<dc:creator>coderrr</dc:creator>
		<pubDate>Sun, 08 Feb 2009 19:02:09 +0000</pubDate>
		<guid isPermaLink="false">http://coderrr.wordpress.com/?p=201#comment-1224</guid>
		<description>yea good pt thx

$:.map{rand(?{).chr[/[^_\W]/]&#124;&#124;redo}*&#039;&#039;

yea i agree in practice you probly wouldn&#039;t run into it much, i wonder what the probability is.

you could shave off one more char i think:

rand.to_s.crypt($0).tr(&#039;./&#039;,&#039;&#039;)[2,9]

or even shorter at the cost of losing all $0 chars and being under 4 more often:

34
rand.to_s.crypt($0).tr(&quot;./#$0&quot;,&#039;&#039;)</description>
		<content:encoded><![CDATA[<p>yea good pt thx</p>
<p>$:.map{rand(?{).chr[/[^_\W]/]||redo}*&#8221;</p>
<p>yea i agree in practice you probly wouldn&#8217;t run into it much, i wonder what the probability is.</p>
<p>you could shave off one more char i think:</p>
<p>rand.to_s.crypt($0).tr(&#8216;./&#8217;,&#8221;)[2,9]</p>
<p>or even shorter at the cost of losing all $0 chars and being under 4 more often:</p>
<p>34<br />
rand.to_s.crypt($0).tr(&#8220;./#$0&#8243;,&#8221;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JeffMo</title>
		<link>http://coderrr.wordpress.com/2008/10/28/ruby-golf-generating-random-strings/#comment-1223</link>
		<dc:creator>JeffMo</dc:creator>
		<pubDate>Sun, 08 Feb 2009 18:25:00 +0000</pubDate>
		<guid isPermaLink="false">http://coderrr.wordpress.com/?p=201#comment-1223</guid>
		<description>LOL, that copied IRB session got hosed a bit. Trying again:

irb(main):002:0&gt; (1..10000000).map.any? { rand.to_s.crypt($0).delete(&#039;/.&#039;)[2,9].size &lt; 4 }
=&gt; false</description>
		<content:encoded><![CDATA[<p>LOL, that copied IRB session got hosed a bit. Trying again:</p>
<p>irb(main):002:0&gt; (1..10000000).map.any? { rand.to_s.crypt($0).delete(&#8216;/.&#8217;)[2,9].size &lt; 4 }<br />
=&gt; false</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JeffMo</title>
		<link>http://coderrr.wordpress.com/2008/10/28/ruby-golf-generating-random-strings/#comment-1222</link>
		<dc:creator>JeffMo</dc:creator>
		<pubDate>Sun, 08 Feb 2009 18:21:55 +0000</pubDate>
		<guid isPermaLink="false">http://coderrr.wordpress.com/?p=201#comment-1222</guid>
		<description>@coderrr:

I agree that is a theoretical drawback to the crypt solution I offered. However, it works pretty reliably in practice:

irb(main):001:0&gt; (1..10000000).map.any? { rand.to_s.crypt($0).delete(&#039;/.&#039;)[2,9].size  false

Also, you&#039;ll probably want to make the same correction to your &quot;38&quot; solution that I suggested for Magnus&#039;s solution earlier. (As it stands, it won&#039;t generate any &#039;z&#039; chars.)</description>
		<content:encoded><![CDATA[<p>@coderrr:</p>
<p>I agree that is a theoretical drawback to the crypt solution I offered. However, it works pretty reliably in practice:</p>
<p>irb(main):001:0&gt; (1..10000000).map.any? { rand.to_s.crypt($0).delete(&#8216;/.&#8217;)[2,9].size  false</p>
<p>Also, you&#8217;ll probably want to make the same correction to your &#8220;38&#8243; solution that I suggested for Magnus&#8217;s solution earlier. (As it stands, it won&#8217;t generate any &#8216;z&#8217; chars.)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
