<?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>the cosmotron &#187; ntl</title>
	<atom:link href="http://thecosmotron.com/tag/ntl/feed/" rel="self" type="application/rss+xml" />
	<link>http://thecosmotron.com</link>
	<description>the blog of ryan lewis</description>
	<lastBuildDate>Wed, 09 May 2012 21:17:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Random Numbers and NTL</title>
		<link>http://thecosmotron.com/2008/12/04/random-numbers-and-ntl/</link>
		<comments>http://thecosmotron.com/2008/12/04/random-numbers-and-ntl/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 01:36:39 +0000</pubDate>
		<dc:creator>Ryan Lewis</dc:creator>
				<category><![CDATA[Planet COSI]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Update]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[ntl]]></category>
		<category><![CDATA[Random]]></category>
		<category><![CDATA[random numbers]]></category>
		<category><![CDATA[seed]]></category>
		<category><![CDATA[ZZ]]></category>

		<guid isPermaLink="false">http://thecosmotron.com/?p=68</guid>
		<description><![CDATA[According to its website, the Number Theory Library (NTL) is a: high-performance, portable C++ library providing data structures and algorithms for manipulating signed, arbitrary length integers, and for vectors, matrices, and polynomials over the integers and over finite fields. I have been using it a lot because of the Cryptography class that I&#8217;m in this [...]]]></description>
			<content:encoded><![CDATA[<p>According to its website, the <a href="http://www.shoup.net/ntl/">Number Theory Library</a> (NTL) is a:</p>
<blockquote><p>high-performance, portable C++ library providing data structures and algorithms for manipulating signed, arbitrary length integers, and for vectors, matrices, and polynomials over the integers and over finite fields. </p></blockquote>
<p>I have been using it a lot because of the Cryptography class that I&#8217;m in this semester, and something that I need to do frequently is generate random numbers.</p>
<p>To do this, seeding is frequently required, and the NTL is no different, but it took a while for me to actually get it to work.  The following will seed the random functions provided by the NTL ZZ class:</p>
<pre>ZZ number, seed;
srand(getpid());
seed &lt;&lt; ((long) GetTime() ^ rand());
SetSeed(seed);
RandomLen(number, rand() % 300);</pre>
<p>Stick that at the top of your <code>main()</code> and you should be all set.</p>
<p>Also, does anyone know of a shorter, possibly easier to remember, way to do this?  If so, the comments are open.</p>
]]></content:encoded>
			<wfw:commentRss>http://thecosmotron.com/2008/12/04/random-numbers-and-ntl/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

