Menu

RandomLib / News: Recent posts

Advice on RandomLib and C++11

If you are currently using RandomLib and expect to be working on
applications involving random numbers for the next few years, please see
my advice at http://randomlib.sf.net:

IMPORTANT NOTE: The original motivation for this library was to
provide a robust and portable library for random numbers of C++
applications. Now that C++11 is widely available, you should
transition to using the <random> header for most applications. On
Linux and Mac OSX, supply the -std=c++0x or -std=c++11 flag to the
compiler. On Windows, use Visual Studio 11 (2012) and later. Exact
sampling from the normal and discrete normal distributions is now
available with the exrandom package which is built on the C++11 random
number facilities.... read more</random>

Posted by Charles Karney 2014-12-04

RandomLib 1.10 (released 2014-11-22)

Changes between 1.10 (released 2014-11-22) and 1.9 versions:

  • Maintenance release:
    • tweaks to the cmake build support and the documentation;
    • strengthen the advice to use C++11.
Posted by Charles Karney 2014-11-22

RANDOMLIB_SHARED_LIB must be 0 or 1

After upgrading to RandomLib version 1.9 or later, it's possible that
projects that compile and link to RandomLib will get this compiler
error:

#error :  RANDOMLIB_SHARED_LIB must be 0 or 1

This will only happen on non-Windows systems and is caused by cmake
finding the cmake configuration for a pre-1.9 version of RandomLib. The
fix is to remove all earlier cmake configuration files with (as root):... read more

Posted by Charles Karney 2014-03-15

RandomLib 1.9 (released 2014-03-15)

Changes between 1.9 (released 2014-03-15) and 1.8 versions:

  • Many changes in cmake support:
    • minimum version of cmake needed increased to 2.8.4 (which was
      released in 2011-02);
    • allow building both shared and static libraries with -D
      RANDOMLIB_LIB_TYPE=BOTH;
    • both shared and static libraries (Release plus Debug) included in
      binary installer;
    • find_package uses COMPONENTS and RandomLib_USE_STATIC_LIBS to
      select the library to use;
    • find_package version checking allows nmake and Visual Studio
      generators to interoperate on Windows;
    • find_package (RandomLib ...) requires that RandomLib be
      capitalized correctly;
    • on Unix/Linux, don't include the version number in directory for
      the cmake configuration files;
    • defaults for RANDOMLIB_DOCUMENTATION is now OFF;
    • the configuration parameters PACKAGE_PATH and INSTALL_PATH are
      now deprecated (use CMAKE_INSTALL_PREFIX instead).... read more
Posted by Charles Karney 2014-03-15

RandomLib 1.8 (released 2013-10-08)

  • Work around a problem with Visual Studio 9.
Posted by Charles Karney 2013-10-08

Fix to missing abs(long long) with Visual Studio 9

Visual Studio 9 has a long long type. However std::abs doesn't work for this type. This bug causes the compilation of RandomCoverage to abort. The following patch avoids this problem:

diff --git a/examples/RandomCoverage.cpp b/examples/RandomCoverage.cpp
index 44519b6..a89ee42 100644
--- a/examples/RandomCoverage.cpp
+++ b/examples/RandomCoverage.cpp
@@ -279,11 +279,15 @@ void coverage32() {
   { RandomLib::DiscreteNormal<short> pd(7); repeat pd(r); }
   { RandomLib::DiscreteNormal<int> pd(7,1,1,2); repeat pd(r); }
   { RandomLib::DiscreteNormal<long> pd(7,1,1,2); repeat pd(r); }
-      { RandomLib::DiscreteNormal<long long> pd(7); repeat pd(r); }
   { RandomLib::DiscreteNormalAlt<short,1> pd(7); repeat pd(r)(r); }
   { RandomLib::DiscreteNormalAlt<int,8> pd(7); repeat pd(r)(r); }
   { RandomLib::DiscreteNormalAlt<long,28> pd(7); repeat pd(r)(r); }
+#if !(defined(_MSC_VER) && _MSC_VER < 1600)
+// Visual Studio 9 (and earlier?) has a long long but doesn't have a std::abs
+// for this type.  So skip the long long tests for DiscreteNormal{,Alt}.
+      { RandomLib::DiscreteNormal<long long> pd(7); repeat pd(r); }
   { RandomLib::DiscreteNormalAlt<long long,32> pd(7); repeat pd(r)(r); }
+#endif
   { RandomLib::InversePiProb pd; repeat pd(r); }
   { RandomLib::InverseEProb pd; repeat pd(r); }
 }
@@ -551,11 +555,15 @@ void coverage64() {
   { RandomLib::DiscreteNormal<short> pd(7); repeat pd(r); }
   { RandomLib::DiscreteNormal<int> pd(7,1,1,2); repeat pd(r); }
   { RandomLib::DiscreteNormal<long> pd(7,1,1,2); repeat pd(r); }
-      { RandomLib::DiscreteNormal<long long> pd(7); repeat pd(r); }
   { RandomLib::DiscreteNormalAlt<short,1> pd(7); repeat pd(r)(r); }
   { RandomLib::DiscreteNormalAlt<int,8> pd(7); repeat pd(r)(r); }
   { RandomLib::DiscreteNormalAlt<long,28> pd(7); repeat pd(r)(r); }
+#if !(defined(_MSC_VER) && _MSC_VER < 1600)
+// Visual Studio 9 (and earlier?) has a long long but doesn't have a std::abs
+// for this type.  So skip the long long tests for DiscreteNormal{,Alt}.
+      { RandomLib::DiscreteNormal<long long> pd(7); repeat pd(r); }
   { RandomLib::DiscreteNormalAlt<long long,32> pd(7); repeat pd(r)(r); }
+#endif
   { RandomLib::InversePiProb pd; repeat pd(r); }
   { RandomLib::InverseEProb pd; repeat pd(r); }
 }
Posted by Charles Karney 2013-10-01

RandomLib 1.7 (released 2013-09-27)

  • Add UniformInteger, DiscreteNormal, and DiscreteNormalAlt.
  • cmake configuration changes:
    • use folders in Visual Studio to reduce clutter;
    • improving setting of runtime path for Unix-like OS;
    • install PDB files when compiling with Visual Studio to aid
      debugging.
  • Eliminate link error in debug mode (in RandomMixer) and various
    warning messages.
  • Add macros RANDOMLIB_VERSION_{MAJOR,MINOR,PATCH} to Config.h.
Posted by Charles Karney 2013-09-27

RandomLib 1.6 (released 2012-09-13)

This is a maintenance release. Changes

  • Documentation changes:
    • remove html documentation from distribution and use web links if
      doxygen is not available;
    • use doxygen tags to document exceptions;
    • use Greek letters where appropriate (requires doxygen 1.8.1.2 or
      later);
    • use MathJax to display equations.
  • Support building with cygwin and mingw32-g++ on Windows (via
    cmake).
  • Releases via git now use the "release" branch of the main
    randomlib repository (instead of a separate randomlib-release
    repository).
Posted by Charles Karney 2012-09-13

RandomLib 1.5 (released 2012-03-20)

This is a maintenance release. Changes

  • cmake tweaks:
  • improve find_package's matching of compiler versions;
  • CMAKE_INSTALL_PREFIX set from CMAKE_PREFIX_PATH if available;
  • fix cmake warning with Visual Studio Express.

  • Fix for compilation with Visual Studio 11.

Posted by Charles Karney 2012-03-20

RandomLib 1.4 (released 2012-02-21)

  • Add MPFR interface.
  • Add InversePiProb and InverseEProb.
  • Change RandomNumber to a signed-magnitude representation; this results in slight incompatibilities in the interface.
  • A tweak to ExactNormal to minimize the number of digits generated.
  • Improve efficiency of ExactExponential.
  • Improve documentation on configuration with cmake.
  • cmake's find_package ensures that the compiler versions match on Windows.
Posted by Charles Karney 2012-02-21

RandomLib 1.3 (released 2012-01-21)

This is a maintenance release. Changes:

  • Improve algorithm used by RandomLib::ExactNormal class.

  • Add internal documenation to the cmake configuration files.

Posted by Charles Karney 2012-01-21

RandomLib 1.2 (released 2011-12-20)

  • Change license to MIT/X11.

  • Add RandomLib::ExactNormal class. This enables you to sample
    exactly from a normal distribution with zero mean and unit variance
    (assuming that the underlying generator is perfect).

  • Document function arguments and return values.

  • Include OpenMP header in RandomThread.cpp.

Posted by Charles Karney 2011-12-20

RandomLib 1.1 (released 2011-09-21)

No code changes...

  • Ensure that randomlib-config.cmake is relocatable.
Posted by Charles Karney 2011-09-21

RandomLib 1.0 (released 2011-08-12)

No code changes...

  • cmake changes:
  • include FindRandom.cmake in distribution;
  • building with cmake creates and installs randomlib-config.cmake;
  • better support for building a shared library under Windows.
Posted by Charles Karney 2011-08-12

RandomLib 2011-06 released

Changes between 2011-06 and 2010-05 versions:

  • Convert parallelization example, RandomThread.cpp, to OpenMP.
  • Migrate source from subversion to git.
Posted by Charles Karney 2011-06-04

RandomLib 2011-05 released

Changes between 2011-05 and 2010-04 versions:

  • INCOMPATIBLE CHANGE: the default constructor Random r; sets the seed
    to []. Use r.Reseed(); to reset the seed to Random::SeedVector();
  • Make sure Global generators are exported to the dll.
Posted by Charles Karney 2011-05-17

BUG (and fix) configuring with cmake

cmake does not configure RandomLib properly if it can't find boost.
The following patch fixes this. (RandomLib does not require boost.)

Index: examples/CMakeLists.txt

--- examples/CMakeLists.txt (revision 6940)
+++ examples/CMakeLists.txt (revision 6951)
@@ -1,6 +1,9 @@
# $Id$

-include_directories (${Boost_INCLUDE_DIRS})
+if (Boost_FOUND)
+ include_directories (${Boost_INCLUDE_DIRS})
+endif (Boost_FOUND)
+
add_custom_target (examples ALL)
foreach (EXAMPLE ${EXAMPLES})

Posted by Charles Karney 2011-05-04

RandomLib 2011-04 released

The code has been moved on subversion on sourceforge and
the build procedures have been reorganized. The code
remains largely the same.

  • Use cmake for configuration.
  • Improve documentation on installation process.
  • Improve documentation of parallelization.
  • Remove examples RandomPermutation and shuffle and add
    RandomCoverage, RandomExact, RandomLambda, RandomSave,
    and RandomThread.
  • Add specialized swap.
  • Ensure the code works with compilers with no long double
    type.
  • Add new and delete operators for SFMT19937 under Visual
    Studio.
Posted by Charles Karney 2011-04-12

#input &lt;iterator&gt; needed

John DeWitt has pointed out to me at in some environments

input <iterator>

is required in RandomSeed.hpp. This change will be included in
the next release, but I'm not sure when that will be. In the
meantime, if you run into iterator related problems when
compiling RandomLib then include this additional header.

--Charles

Posted by Charles Karney 2010-04-23