<?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>Ralph Holzmann &#187; Random</title>
	<atom:link href="http://ralphholzmann.com/tag/random/feed/" rel="self" type="application/rss+xml" />
	<link>http://ralphholzmann.com</link>
	<description>Web Development - jQuery, PHP, MySQL. In that order.</description>
	<lastBuildDate>Fri, 29 Jan 2010 14:01:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>One Line Random Boolean in JavaScript</title>
		<link>http://ralphholzmann.com/2009/12/28/one-line-random-boolean-in-javascript/</link>
		<comments>http://ralphholzmann.com/2009/12/28/one-line-random-boolean-in-javascript/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 20:24:49 +0000</pubDate>
		<dc:creator>Ralph</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Boolean]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Random]]></category>

		<guid isPermaLink="false">http://ralphholzmann.com/?p=38</guid>
		<description><![CDATA[Happy Holidays everyone! I hope everyone enjoyed the holidays this year. I&#8217;m back to work today. I just wanted to post a quick snippet that I used in a jQuery plugin I&#8217;m developing. It&#8217;s nothing earth shattering, but I thought &#8230; <a href="http://ralphholzmann.com/2009/12/28/one-line-random-boolean-in-javascript/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Happy Holidays everyone! I hope everyone enjoyed the holidays this year. I&#8217;m back to work today. I just wanted to post a quick snippet that I used in a jQuery plugin I&#8217;m developing. It&#8217;s nothing earth shattering, but I thought it was worth mentioning. It&#8217;s a true random boolean in JavaScript:</p>
<pre class="brush:js" jsbin="http://jsbin.com/opama">!Math.round(Math.random());</pre>
<p>This creates a random number between zero and (almost) 1, then rounds it either up or down, then uses the negation operator <del datetime="2009-12-28T21:07:32+00:00">twice</del> once to convert it to a true boolean (if you pass it to the typeof function, it will return &#8220;boolean&#8221;).</p>
<p>Now back to work!</p>
<p><span class="edit">Edit: Josh Dean pointed out in the comments that only a single negation operator is needed in this case.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://ralphholzmann.com/2009/12/28/one-line-random-boolean-in-javascript/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
