<?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>Cosu &#187; RGC</title>
	<atom:link href="http://cosu.ro/blog/tag/rgc/feed/" rel="self" type="application/rss+xml" />
	<link>http://cosu.ro/blog</link>
	<description>"I'm even greater than I thought I was", Bender Bending Rodríguez , Futurama, S05E01</description>
	<lastBuildDate>Sun, 23 May 2010 17:35:29 +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>Choosing random entries from a group</title>
		<link>http://cosu.ro/blog/2009/11/23/choosing-random-entries-from-a-group/</link>
		<comments>http://cosu.ro/blog/2009/11/23/choosing-random-entries-from-a-group/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 21:31:11 +0000</pubDate>
		<dc:creator>Cosu</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[RGC]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://cosu.ro/blog/2009/11/23/choosing-random-entries-from-a-group/</guid>
		<description><![CDATA[In the past two weeks we had a lottery-type thing on RGC.ro (Romanian Guitarist Community). Proguitar, the official importer of Fender products in Romania, wanted to give-away a custom made Fender Stratocaster electric guitar. To register, the community users had to fill out a form and choose from a series of custom options for the [...]]]></description>
			<content:encoded><![CDATA[<p>In the past two weeks we had a lottery-type thing on <a href="http://www.rgc.ro">RGC.ro</a> (Romanian Guitarist Community). Proguitar, the official importer of Fender products in Romania, wanted to give-away a custom made Fender Stratocaster electric guitar. To register, the community users had to fill out a form and choose from a series of custom options for the guitar.</p>
<p>As organizers we had  to pick out the lucky winner of the raffle.  Usually this is done by someone who is impartial. Due to the fact that we had about 1600 entries and that we are geeks we wanted to do something that geeks would do. Therefore we ditched the &#8220;extract the name of the lucky winner from a bowl&#8221;. The geek version of this is described in<a href="http://www.ietf.org/rfc/rfc2777.txt"> RFC2777 &#8211;  Publicly Verifiable Nomcom Random Selection</a></p>
<p>In short RFC2777 describes a simple publicly verifiable algorithm to pick out a set of entries from a group as random as possible. The keywords here are public &#8211; anyone can see how the entries are picked &#8211; and as random as possible. To have random values a thing called <a href="http://en.wikipedia.org/wiki/Information_entropy">information entropy</a> is needed. To get that initial random value full of juicy entropy we used, as suggested in the RFC, the results from three international lotteries. This initial random value was slightly modified for each &#8220;extracted&#8221; entry and then transformed into a MD5 hash. Due to the nature of a hash when slightly modifying  the original the resulting hash differs heavily from the original hash.</p>
<p>Below you can find a naive python implementation that can be freely used for any purpose. Just make sure you fill in the entropySource with a good initial random value.</p>
<pre>
import md5                                                 

if __name__ == '__main__':

    entropySource = "9.24.30.32.36.40./18.25.35.43.46.47./1.3.4.8.23.31./"

    numberOfEntries = 1655
    numberOfWinners = 10  

    numbers = map( lambda x: x + 1, range( numberOfEntries ) )

    i = 0
    entries = numberOfEntries
    print "index \t hex value of MD5 \t div \t selected"
    while ( i < numberOfWinners ) :
        md5hash = md5.new()
        md5hash.update( chr( i ) + entropySource + chr( i ) )
        val = int( md5hash.hexdigest(), 16 )
        modulo = val % entries
        print str( i + 1 ) + "\t" + md5hash.hexdigest() + "\t" + str( entries ) + "\t" + str( numbers[modulo] )
        del numbers[modulo]
        i += 1
        entries -= 1
</pre>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://cosu.ro/blog/2009/11/23/choosing-random-entries-from-a-group/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Eagle Has Landed</title>
		<link>http://cosu.ro/blog/2008/07/11/the-eagle-has-landed/</link>
		<comments>http://cosu.ro/blog/2008/07/11/the-eagle-has-landed/#comments</comments>
		<pubDate>Fri, 11 Jul 2008 12:00:58 +0000</pubDate>
		<dc:creator>Cosu</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Chitara]]></category>
		<category><![CDATA[RGC]]></category>

		<guid isPermaLink="false">http://cosu.ro/blog/2008/07/11/the-eagle-has-landed/</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="395" alt="image" src="http://cosu.ro/blog/wp-content/uploads/2008/07/image5.png" width="520" border="0"/></p>
]]></content:encoded>
			<wfw:commentRss>http://cosu.ro/blog/2008/07/11/the-eagle-has-landed/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>3 Ani</title>
		<link>http://cosu.ro/blog/2007/10/26/3-ani/</link>
		<comments>http://cosu.ro/blog/2007/10/26/3-ani/#comments</comments>
		<pubDate>Thu, 25 Oct 2007 22:21:44 +0000</pubDate>
		<dc:creator>Cosu</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Chitara]]></category>
		<category><![CDATA[RGC]]></category>

		<guid isPermaLink="false">http://cosu.rgc.ro/blog/2007/10/26/3-ani/</guid>
		<description><![CDATA[Azi se implinesc 3 ani de cand am pornit RGC.ro. Atunci cand am pornit la drum nu ne-am gandit nici o clipa ca o sa aiba atata succes. A fost mai mult o joaca si forumul a aparut dintr-o necesitate a cativa oameni de a discuta mai pe larg despre un subiect cu care abia [...]]]></description>
			<content:encoded><![CDATA[<p>Azi se implinesc 3 ani de cand am pornit RGC.ro. Atunci cand am pornit la drum nu ne-am gandit nici o clipa ca o sa aiba atata succes. A fost mai mult o joaca si forumul a aparut dintr-o necesitate a cativa oameni de a discuta mai pe larg despre un subiect cu care abia incepeau sa aiba tangente. Cu exceptia lui Felix, atat eu cat si Cearny si Ninja eram cam la inceput.</p>
<p>Forumul a crescut extraordinar de mult in 3 ani. De la 0 am ajuns cateva mii de oameni (stiu ca numarul de membrii nu este total relevant pentru ca sunt multi cu clone si cu conturi inactive). Nu statistica e importanta ci faptul ca RGC a ajutat fenomenul muzical din tara. S-au format trupe si prietenii cu ajutorul forumului si cred ca asta este lucrul cu care chiar merita sa ne mandrim.</p>
<p>Fara indoiala exista si parti proaste si neajunsuri dar lucrurile astea imi place sa cred ca le vom elimina cu timpul.</p>
<p>Din pacate timpul nu a permis sa mergem in ritmul pe care mi l-as fi dorit eu dar suntem foarte aproape de a mai pune o piatra peste temelie. In cateva zile (sper ca maxim o saptamana) o sa mai apara ceva poate nu la fel de dinamic precum forumul dar sper eu  la fel de util sau poate chiar mai util.</p>
<p>La multi ani RGC!</p>
]]></content:encoded>
			<wfw:commentRss>http://cosu.ro/blog/2007/10/26/3-ani/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
