RNG Range Projection

RNG Range Projection is a new page discussing the pitfalls of projecting the output of a pseudo-random number generator with a small native range (specifically, the rand() function of MS Visual C++) into an arbitrary target range.

This page essentially replicates the contents of a plain text file that used to be included with my old RandTest.zip package dating back to 2001. Aside from reformatting the text as HTML, the new page and revised package contain the following changes:

  • Added test results for the Visual C++ library function rand_s. This “secure” generator is available on Windows XP and later… and painfully slow.
  • Added test results for a C# port of the Mersenne Twister algorithm. This is a stripped-down version of the port in my Tektosyne Library.
  • Naturally, I reran all tests on my current system to confirm that all conclusions still hold. (They do, except for some minor performance characteristics that were specific to old compilers.)

2015-09-17: Added a second set of test results for my current hardware & software. The original results reproduced nicely, so I could keep my analysis mostly unchanged. Note this means that even in Visual Studio 2015, you should still avoid Visual C++ rand()! Moreover, Microsoft’s secure generator rand_s is much faster in Windows 10 but still much slower than anything else.

Leave a Reply