<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>PCG, A Better Random Number Generator (Posts about entropy)</title><link>http://www.pcg-random.org/</link><description></description><atom:link href="http://www.pcg-random.org/categories/entropy.xml" rel="self" type="application/rss+xml"></atom:link><language>en</language><copyright>Contents © 2026 &lt;a href="mailto:oneill@pcg-random.org"&gt;M.E. O'Neill&lt;/a&gt; </copyright><lastBuildDate>Sat, 10 Jan 2026 00:53:27 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Simple Portable C++ Seed Entropy</title><link>http://www.pcg-random.org/posts/simple-portable-cpp-seed-entropy.html</link><dc:creator>M.E. O'Neill</dc:creator><description>&lt;div&gt;&lt;p&gt;In two recent posts, I've looked at seeding random number generators in in C++11 (looking at &lt;a href="http://www.pcg-random.org/posts/cpp-seeding-surprises.html"&gt;what's wrong with &lt;code&gt;std::seed_seq&lt;/code&gt;&lt;/a&gt; and &lt;a href="http://www.pcg-random.org/posts/developing-a-seed_seq-alternative.html"&gt;developing something that avoids those flaws&lt;/a&gt;), but &lt;code&gt;seed_seq&lt;/code&gt; exists as a mechanism to “mix up” entropy that you give it.  You still need to get that entropy from &lt;em&gt;somewhere&lt;/em&gt;.  So where?&lt;/p&gt;
&lt;h3 id="sadly-stdrandom_device-is-not-your-friend"&gt;Sadly &lt;code&gt;std::random_device&lt;/code&gt; Is Not Your Friend&lt;/h3&gt;
&lt;p&gt;The obvious source for external randomness we can use in seeding is &lt;code&gt;std::random_device&lt;/code&gt;.  But as I mentioned in &lt;a href="http://www.pcg-random.org/posts/cpps-random_device.html"&gt;this post&lt;/a&gt;,&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It's hard to make &lt;code&gt;std::random_device&lt;/code&gt; conform to the requirements of a seed sequence.&lt;/li&gt;
&lt;li&gt;It's unspecified just how costly this “device” is to read from.&lt;/li&gt;
&lt;li&gt;It may not be nondeterministic at all, rendering it unfit for our purposes.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Portable code needs to look to other sources of entropy for RNG seeding.  And even if &lt;code&gt;std::random_device&lt;/code&gt; works well, mixing in entropy from other sources can have a variety of benefits, including performance.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.pcg-random.org/posts/simple-portable-cpp-seed-entropy.html"&gt;Read more…&lt;/a&gt; (14 min remaining to read)&lt;/p&gt;&lt;/div&gt;</description><category>c++</category><category>C++17-ideas</category><category>entropy</category><category>randutils</category><category>seed_seq</category><category>seeding</category><guid>http://www.pcg-random.org/posts/simple-portable-cpp-seed-entropy.html</guid><pubDate>Mon, 04 May 2015 04:37:48 GMT</pubDate></item><item><title>Everything You Never Wanted to Know about C++'s random_device</title><link>http://www.pcg-random.org/posts/cpps-random_device.html</link><dc:creator>M.E. O'Neill</dc:creator><description>&lt;div&gt;&lt;p&gt;Continuing my series of blog posts about seeding random number generators in C++, it's time to take a look at &lt;code&gt;std::random_device&lt;/code&gt;.  In this post, we'll see the many ways in which it isn't really your friend.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.pcg-random.org/posts/cpps-random_device.html"&gt;Read more…&lt;/a&gt; (5 min remaining to read)&lt;/p&gt;&lt;/div&gt;</description><category>c++</category><category>C++17-ideas</category><category>entropy</category><category>seeding</category><guid>http://www.pcg-random.org/posts/cpps-random_device.html</guid><pubDate>Mon, 04 May 2015 03:07:48 GMT</pubDate></item></channel></rss>