<p>I'm looking for a performant, reasonably robust RNG using no special hardware. It can use mathematical methods (Mersenne Twister, etc), it can "collect entropy" from the machine, whatever. On Linux/etc we have a <code>drand48()</code> which generates 48 random bits. I'd like a similar function/class for C++ or C# which can generate more than 32 bits of randomness and which low-order bits are equally as random as high-order bits.</p>

<p>It doesn't have to be cryptographically secure but it must not use or be based on the C-language <code>rand()</code> or .NET <code>System.Random</code>.</p>

<p>Any source code, links to source, etc. would be appreciated! Failing that, what TYPE of RNG should I be looking for?</p>

[{'answer_id': 602, 'author': 'C. K. Young', 'author_id': 13, 'author_profile': 'https://Stackoverflow.com/users/13', 'pm_score': 6, 'selected': True, 'text': '<p>For C++, <a href="http://www.boost.org/libs/random/" rel="noreferrer">Boost.Random</a> is probably what you\'re looking for. It has support for MT (among many other algorithms), and can collect entropy via the <code>nondet_random</code> class. Check it out! :-)</p>\n'}, {'answer_id': 605, 'author': 'Mark Harrison', 'author_id': 116, 'author_profile': 'https://Stackoverflow.com/users/116', 'pm_score': 3, 'selected': False, 'text': '<p><a href="http://www.gnu.org/software/gsl" rel="noreferrer">The Gnu Scientific Library</a> (GSL) has a pretty extensive set of RN generators, test harness, etc.  If you\'re on linux, it\'s probably already available on your system.</p>\n'}, {'answer_id': 10139, 'author': 'nsanders', 'author_id': 1244, 'author_profile': 'https://Stackoverflow.com/users/1244', 'pm_score': 3, 'selected': False, 'text': '<p>Watch out for the Gnu Scientific Library.  It\'s licensed under the GPL rather than LGPL.</p>\n\n<p>As other folks mentioned, the Boost random classes are a good start.  Their implementation conforms to the PRNG code slated for TR1:</p>\n\n<p><a href="http://www.boost.org/doc/libs/1_35_0/libs/random/index.html" rel="nofollow noreferrer">http://www.boost.org/doc/libs/1_35_0/libs/random/index.html</a>\n<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1452.html" rel="nofollow noreferrer">http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1452.html</a></p>\n\n<p>If you have a recent version of the G++ compiler, you may find the TR1 libraries already included</p>\n'}, {'answer_id': 9923618, 'author': 'Rohit Vipin Mathews', 'author_id': 1155650, 'author_profile': 'https://Stackoverflow.com/users/1155650', 'pm_score': 2, 'selected': False, 'text': '<p><code>Boost.Random</code> is my first choice for RNG</p>\n\n<p><a href="http://www.boost.org/doc/libs/random" rel="nofollow">http://www.boost.org/doc/libs/random</a></p>\n'}, {'answer_id': 11211443, 'author': 'bames53', 'author_id': 365496, 'author_profile': 'https://Stackoverflow.com/users/365496', 'pm_score': 3, 'selected': False, 'text': '<p>C++11 has adopted a robust random number library based on boost.random. You can access a number of random number engines using different algorithms to meet your quality, speed, or size requirements. Quality implementations will even provide access to whatever non-deterministic RNG your platform offers via <code>std::random_device</code>.</p>\n\n<p>In addition there are many adaptors to produce specific distributions, eliminating the need to do such manipulation by hand (something often done incorrectly).</p>\n\n<p><a href="http://en.cppreference.com/w/cpp/numeric/random" rel="noreferrer"><code>#include &lt;random&gt;</code></a></p>\n'}]
['https://Stackoverflow.com/questions/601', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']