$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r52492 - in branches/release: boost/random boost/random/detail libs/random libs/random/test
From: steven_at_[hidden]
Date: 2009-04-19 10:56:01
Author: steven_watanabe
Date: 2009-04-19 10:55:57 EDT (Sun, 19 Apr 2009)
New Revision: 52492
URL: http://svn.boost.org/trac/boost/changeset/52492
Log:
Merge [50997], [51120], [51171], [51210], [51253], [51311], [51337], [51400], [51410], [51413] from the trunk
Added:
   branches/release/boost/random/detail/config.hpp
      - copied unchanged from r52427, /trunk/boost/random/detail/config.hpp
   branches/release/libs/random/instantiate.cpp
      - copied unchanged from r52427, /trunk/libs/random/instantiate.cpp
   branches/release/libs/random/validate.cpp
      - copied unchanged from r52427, /trunk/libs/random/validate.cpp
Text files modified: 
   branches/release/boost/random/additive_combine.hpp         |     3                                         
   branches/release/boost/random/bernoulli_distribution.hpp   |     3                                         
   branches/release/boost/random/binomial_distribution.hpp    |     3                                         
   branches/release/boost/random/cauchy_distribution.hpp      |     3                                         
   branches/release/boost/random/detail/uniform_int_float.hpp |     3                                         
   branches/release/boost/random/discard_block.hpp            |     3                                         
   branches/release/boost/random/exponential_distribution.hpp |     3                                         
   branches/release/boost/random/gamma_distribution.hpp       |     3                                         
   branches/release/boost/random/geometric_distribution.hpp   |     3                                         
   branches/release/boost/random/inversive_congruential.hpp   |     5                                         
   branches/release/boost/random/lagged_fibonacci.hpp         |    11                                         
   branches/release/boost/random/linear_congruential.hpp      |    13 +                                       
   branches/release/boost/random/linear_feedback_shift.hpp    |     5                                         
   branches/release/boost/random/lognormal_distribution.hpp   |     3                                         
   branches/release/boost/random/mersenne_twister.hpp         |     3                                         
   branches/release/boost/random/normal_distribution.hpp      |     3                                         
   branches/release/boost/random/poisson_distribution.hpp     |     3                                         
   branches/release/boost/random/shuffle_output.hpp           |     2                                         
   branches/release/boost/random/subtract_with_carry.hpp      |     5                                         
   branches/release/boost/random/triangle_distribution.hpp    |     3                                         
   branches/release/boost/random/uniform_01.hpp               |   151 +++++++++++++++-                        
   branches/release/boost/random/uniform_int.hpp              |     9                                         
   branches/release/boost/random/uniform_on_sphere.hpp        |     3                                         
   branches/release/boost/random/uniform_real.hpp             |     3                                         
   branches/release/boost/random/uniform_smallint.hpp         |   136 ---------------                         
   branches/release/boost/random/xor_combine.hpp              |    27 +-                                      
   branches/release/libs/random/index.html                    |     4                                         
   branches/release/libs/random/random_device.cpp             |     4                                         
   branches/release/libs/random/random_test.cpp               |   343 ----------------------------------------
   branches/release/libs/random/test/Jamfile.v2               |    45 ++++-                                   
   30 files changed, 255 insertions(+), 553 deletions(-)
Modified: branches/release/boost/random/additive_combine.hpp
==============================================================================
--- branches/release/boost/random/additive_combine.hpp	(original)
+++ branches/release/boost/random/additive_combine.hpp	2009-04-19 10:55:57 EDT (Sun, 19 Apr 2009)
@@ -20,6 +20,7 @@
 #include <algorithm> // for std::min and std::max
 #include <boost/config.hpp>
 #include <boost/cstdint.hpp>
+#include <boost/random/detail/config.hpp>
 #include <boost/random/linear_congruential.hpp>
 
 namespace boost {
@@ -85,7 +86,7 @@
 
 #ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
 
-#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const additive_combine& r)
Modified: branches/release/boost/random/bernoulli_distribution.hpp
==============================================================================
--- branches/release/boost/random/bernoulli_distribution.hpp	(original)
+++ branches/release/boost/random/bernoulli_distribution.hpp	2009-04-19 10:55:57 EDT (Sun, 19 Apr 2009)
@@ -18,6 +18,7 @@
 
 #include <cassert>
 #include <iostream>
+#include <boost/random/detail/config.hpp>
 
 namespace boost {
 
@@ -53,7 +54,7 @@
       return RealType(eng() - (eng.min)()) <= _p * RealType((eng.max)()-(eng.min)());
   }
 
-#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const bernoulli_distribution& bd)
Modified: branches/release/boost/random/binomial_distribution.hpp
==============================================================================
--- branches/release/boost/random/binomial_distribution.hpp	(original)
+++ branches/release/boost/random/binomial_distribution.hpp	2009-04-19 10:55:57 EDT (Sun, 19 Apr 2009)
@@ -16,6 +16,7 @@
 
 #include <boost/config/no_tr1/cmath.hpp>
 #include <cassert>
+#include <boost/random/detail/config.hpp>
 #include <boost/random/bernoulli_distribution.hpp>
 
 namespace boost {
@@ -53,7 +54,7 @@
     return n;
   }
 
-#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const binomial_distribution& bd)
Modified: branches/release/boost/random/cauchy_distribution.hpp
==============================================================================
--- branches/release/boost/random/cauchy_distribution.hpp	(original)
+++ branches/release/boost/random/cauchy_distribution.hpp	2009-04-19 10:55:57 EDT (Sun, 19 Apr 2009)
@@ -20,6 +20,7 @@
 #include <iostream>
 #include <boost/limits.hpp>
 #include <boost/static_assert.hpp>
+#include <boost/random/detail/config.hpp>
 
 namespace boost {
 
@@ -62,7 +63,7 @@
     return _median + _sigma * tan(pi*(eng()-result_type(0.5)));
   }
 
-#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const cauchy_distribution& cd)
Modified: branches/release/boost/random/detail/uniform_int_float.hpp
==============================================================================
--- branches/release/boost/random/detail/uniform_int_float.hpp	(original)
+++ branches/release/boost/random/detail/uniform_int_float.hpp	2009-04-19 10:55:57 EDT (Sun, 19 Apr 2009)
@@ -15,6 +15,7 @@
 #define BOOST_RANDOM_DETAIL_UNIFORM_INT_FLOAT_HPP
 
 #include <boost/config.hpp>
+#include <boost/random/detail/config.hpp>
 #include <boost/random/uniform_01.hpp>
 
 
@@ -45,7 +46,7 @@
     return static_cast<IntType>(_rng() * _range) + _min;
   }
 
-#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const uniform_int_float& ud)
Modified: branches/release/boost/random/discard_block.hpp
==============================================================================
--- branches/release/boost/random/discard_block.hpp	(original)
+++ branches/release/boost/random/discard_block.hpp	2009-04-19 10:55:57 EDT (Sun, 19 Apr 2009)
@@ -20,6 +20,7 @@
 #include <boost/config.hpp>
 #include <boost/limits.hpp>
 #include <boost/static_assert.hpp>
+#include <boost/random/detail/config.hpp>
 
 
 namespace boost {
@@ -69,7 +70,7 @@
 
 #ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
 
-#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const discard_block& s)
Modified: branches/release/boost/random/exponential_distribution.hpp
==============================================================================
--- branches/release/boost/random/exponential_distribution.hpp	(original)
+++ branches/release/boost/random/exponential_distribution.hpp	2009-04-19 10:55:57 EDT (Sun, 19 Apr 2009)
@@ -21,6 +21,7 @@
 #include <iostream>
 #include <boost/limits.hpp>
 #include <boost/static_assert.hpp>
+#include <boost/random/detail/config.hpp>
 
 namespace boost {
 
@@ -54,7 +55,7 @@
     return -result_type(1) / _lambda * log(result_type(1)-eng());
   }
 
-#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const exponential_distribution& ed)
Modified: branches/release/boost/random/gamma_distribution.hpp
==============================================================================
--- branches/release/boost/random/gamma_distribution.hpp	(original)
+++ branches/release/boost/random/gamma_distribution.hpp	2009-04-19 10:55:57 EDT (Sun, 19 Apr 2009)
@@ -18,6 +18,7 @@
 #include <cassert>
 #include <boost/limits.hpp>
 #include <boost/static_assert.hpp>
+#include <boost/random/detail/config.hpp>
 #include <boost/random/exponential_distribution.hpp>
 
 namespace boost {
@@ -93,7 +94,7 @@
     }
   }
 
-#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const gamma_distribution& gd)
Modified: branches/release/boost/random/geometric_distribution.hpp
==============================================================================
--- branches/release/boost/random/geometric_distribution.hpp	(original)
+++ branches/release/boost/random/geometric_distribution.hpp	2009-04-19 10:55:57 EDT (Sun, 19 Apr 2009)
@@ -19,6 +19,7 @@
 #include <boost/config/no_tr1/cmath.hpp>          // std::log
 #include <cassert>
 #include <iostream>
+#include <boost/random/detail/config.hpp>
 #include <boost/random/uniform_01.hpp>
 
 namespace boost {
@@ -59,7 +60,7 @@
     return IntType(floor(log(RealType(1)-eng()) / _log_p)) + IntType(1);
   }
 
-#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const geometric_distribution& gd)
Modified: branches/release/boost/random/inversive_congruential.hpp
==============================================================================
--- branches/release/boost/random/inversive_congruential.hpp	(original)
+++ branches/release/boost/random/inversive_congruential.hpp	2009-04-19 10:55:57 EDT (Sun, 19 Apr 2009)
@@ -21,6 +21,7 @@
 #include <stdexcept>
 #include <boost/config.hpp>
 #include <boost/static_assert.hpp>
+#include <boost/random/detail/config.hpp>
 #include <boost/random/detail/const_mod.hpp>
 
 namespace boost {
@@ -71,11 +72,11 @@
     return value;
   }
 
-  bool validation(result_type x) const { return val == x; }
+  static bool validation(result_type x) { return val == x; }
 
 #ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
 
-#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, inversive_congruential x)
Modified: branches/release/boost/random/lagged_fibonacci.hpp
==============================================================================
--- branches/release/boost/random/lagged_fibonacci.hpp	(original)
+++ branches/release/boost/random/lagged_fibonacci.hpp	2009-04-19 10:55:57 EDT (Sun, 19 Apr 2009)
@@ -27,6 +27,7 @@
 #include <boost/detail/workaround.hpp>
 #include <boost/random/linear_congruential.hpp>
 #include <boost/random/uniform_01.hpp>
+#include <boost/random/detail/config.hpp>
 #include <boost/random/detail/pass_through_engine.hpp>
 
 namespace boost {
@@ -141,7 +142,7 @@
   
 #ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
 
-#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const lagged_fibonacci& f)
@@ -317,12 +318,14 @@
     unsigned long mask = ~((~0u) << (w%32));   // now lowest w bits set
     RealType two32 = pow(RealType(2), 32);
     unsigned int j;
-    for(j = 0; j < long_lag && first != last; ++j, ++first) {
+    for(j = 0; j < long_lag && first != last; ++j) {
       x[j] = RealType(0);
       for(int k = 0; k < w/32 && first != last; ++k, ++first)
         x[j] += *first / pow(two32,k+1);
-      if(first != last && mask != 0)
+      if(first != last && mask != 0) {
         x[j] += fmod((*first & mask) / _modulus, RealType(1));
+        ++first;
+      }
     }
     i = long_lag;
     if(first == last && j < long_lag)
@@ -352,7 +355,7 @@
   
 #ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
 
-#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const lagged_fibonacci_01&f)
Modified: branches/release/boost/random/linear_congruential.hpp
==============================================================================
--- branches/release/boost/random/linear_congruential.hpp	(original)
+++ branches/release/boost/random/linear_congruential.hpp	2009-04-19 10:55:57 EDT (Sun, 19 Apr 2009)
@@ -22,6 +22,7 @@
 #include <boost/config.hpp>
 #include <boost/limits.hpp>
 #include <boost/static_assert.hpp>
+#include <boost/random/detail/config.hpp>
 #include <boost/random/detail/const_mod.hpp>
 #include <boost/detail/workaround.hpp>
 
@@ -65,7 +66,11 @@
   }
 
   template<class It>
-  linear_congruential(It& first, It last) { seed(first, last); }
+  linear_congruential(It& first, It last)
+    : _modulus(modulus)
+  {
+      seed(first, last);
+  }
 
   // compiler-generated copy constructor and assignment operator are fine
   void seed(IntType x0 = 1)
@@ -110,7 +115,7 @@
                          const linear_congruential& y)
   { return !(x == y); }
     
-#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) && !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
+#if !defined(BOOST_RANDOM_NO_STREAM_OPERATORS) && !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os,
@@ -152,7 +157,7 @@
 {
     return is >> lcg._x;
 }
-#elif defined(BOOST_NO_OPERATORS_IN_NAMESPACE) || defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
+#elif defined(BOOST_RANDOM_NO_STREAM_OPERATORS) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
 template<class CharT, class Traits, class IntType, IntType a, IntType c, IntType m, IntType val>
 std::basic_ostream<CharT,Traits>&
 operator<<(std::basic_ostream<CharT,Traits>& os,
@@ -221,7 +226,7 @@
 
 #ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
 
-#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT,class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const rand48& r)
Modified: branches/release/boost/random/linear_feedback_shift.hpp
==============================================================================
--- branches/release/boost/random/linear_feedback_shift.hpp	(original)
+++ branches/release/boost/random/linear_feedback_shift.hpp	2009-04-19 10:55:57 EDT (Sun, 19 Apr 2009)
@@ -20,6 +20,7 @@
 #include <boost/config.hpp>
 #include <boost/static_assert.hpp>
 #include <boost/limits.hpp>
+#include <boost/random/detail/config.hpp>
 
 namespace boost {
 namespace random {
@@ -92,11 +93,11 @@
     value = ((value & mask) << s) ^ b;
     return value;
   }
-  bool validation(result_type x) const { return val == x; }
+  static bool validation(result_type x) { return val == x; }
 
 #ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
 
-#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, linear_feedback_shift x)
Modified: branches/release/boost/random/lognormal_distribution.hpp
==============================================================================
--- branches/release/boost/random/lognormal_distribution.hpp	(original)
+++ branches/release/boost/random/lognormal_distribution.hpp	2009-04-19 10:55:57 EDT (Sun, 19 Apr 2009)
@@ -21,6 +21,7 @@
 #include <iostream>
 #include <boost/limits.hpp>
 #include <boost/static_assert.hpp>
+#include <boost/random/detail/config.hpp>
 #include <boost/random/normal_distribution.hpp>
 
 #ifdef BOOST_NO_STDC_NAMESPACE
@@ -74,7 +75,7 @@
     return exp(_normal(eng) * _nsigma + _nmean);
   }
 
-#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const lognormal_distribution& ld)
Modified: branches/release/boost/random/mersenne_twister.hpp
==============================================================================
--- branches/release/boost/random/mersenne_twister.hpp	(original)
+++ branches/release/boost/random/mersenne_twister.hpp	2009-04-19 10:55:57 EDT (Sun, 19 Apr 2009)
@@ -26,6 +26,7 @@
 #include <boost/cstdint.hpp>
 #include <boost/random/linear_congruential.hpp>
 #include <boost/detail/workaround.hpp>
+#include <boost/random/detail/config.hpp>
 #include <boost/random/detail/ptr_helper.hpp>
 
 namespace boost {
@@ -130,7 +131,7 @@
 
 #ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
 
-#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const mersenne_twister& mt)
Modified: branches/release/boost/random/normal_distribution.hpp
==============================================================================
--- branches/release/boost/random/normal_distribution.hpp	(original)
+++ branches/release/boost/random/normal_distribution.hpp	2009-04-19 10:55:57 EDT (Sun, 19 Apr 2009)
@@ -21,6 +21,7 @@
 #include <iostream>
 #include <boost/limits.hpp>
 #include <boost/static_assert.hpp>
+#include <boost/random/detail/config.hpp>
 
 namespace boost {
 
@@ -80,7 +81,7 @@
       * _sigma + _mean;
   }
 
-#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const normal_distribution& nd)
Modified: branches/release/boost/random/poisson_distribution.hpp
==============================================================================
--- branches/release/boost/random/poisson_distribution.hpp	(original)
+++ branches/release/boost/random/poisson_distribution.hpp	2009-04-19 10:55:57 EDT (Sun, 19 Apr 2009)
@@ -19,6 +19,7 @@
 #include <iostream>
 #include <boost/limits.hpp>
 #include <boost/static_assert.hpp>
+#include <boost/random/detail/config.hpp>
 
 namespace boost {
 
@@ -60,7 +61,7 @@
     }
   }
 
-#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const poisson_distribution& pd)
Modified: branches/release/boost/random/shuffle_output.hpp
==============================================================================
--- branches/release/boost/random/shuffle_output.hpp	(original)
+++ branches/release/boost/random/shuffle_output.hpp	2009-04-19 10:55:57 EDT (Sun, 19 Apr 2009)
@@ -84,7 +84,7 @@
 
 #ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
 
-#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const shuffle_output& s)
Modified: branches/release/boost/random/subtract_with_carry.hpp
==============================================================================
--- branches/release/boost/random/subtract_with_carry.hpp	(original)
+++ branches/release/boost/random/subtract_with_carry.hpp	2009-04-19 10:55:57 EDT (Sun, 19 Apr 2009)
@@ -26,6 +26,7 @@
 #include <boost/cstdint.hpp>
 #include <boost/static_assert.hpp>
 #include <boost/detail/workaround.hpp>
+#include <boost/random/detail/config.hpp>
 #include <boost/random/linear_congruential.hpp>
 
 
@@ -153,7 +154,7 @@
   
 #ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
 
-#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os,
@@ -345,7 +346,7 @@
   
 #ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
 
-#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os,
Modified: branches/release/boost/random/triangle_distribution.hpp
==============================================================================
--- branches/release/boost/random/triangle_distribution.hpp	(original)
+++ branches/release/boost/random/triangle_distribution.hpp	2009-04-19 10:55:57 EDT (Sun, 19 Apr 2009)
@@ -18,6 +18,7 @@
 
 #include <boost/config/no_tr1/cmath.hpp>
 #include <cassert>
+#include <boost/random/detail/config.hpp>
 #include <boost/random/uniform_01.hpp>
 
 namespace boost {
@@ -60,7 +61,7 @@
       return _c - d3*sqrt(d2*u-d1);
   }
 
-#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const triangle_distribution& td)
Modified: branches/release/boost/random/uniform_01.hpp
==============================================================================
--- branches/release/boost/random/uniform_01.hpp	(original)
+++ branches/release/boost/random/uniform_01.hpp	2009-04-19 10:55:57 EDT (Sun, 19 Apr 2009)
@@ -20,15 +20,59 @@
 #include <boost/config.hpp>
 #include <boost/limits.hpp>
 #include <boost/static_assert.hpp>
+#include <boost/random/detail/config.hpp>
+#include <boost/random/detail/pass_through_engine.hpp>
 
 namespace boost {
 
-// Because it is so commonly used: uniform distribution on the real [0..1)
-// range.  This allows for specializations to avoid a costly int -> float
-// conversion plus float multiplication
-template<class UniformRandomNumberGenerator, class RealType = double>
-class uniform_01
+namespace detail {
+
+template<class RealType>
+class new_uniform_01
+{
+public:
+  typedef RealType input_type;
+  typedef RealType result_type;
+  // compiler-generated copy ctor and copy assignment are fine
+  result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return result_type(0); }
+  result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return result_type(1); }
+  void reset() { }
+
+  template<class Engine>
+  result_type operator()(Engine& eng) {
+    for (;;) {
+      typedef typename Engine::result_type base_result;
+      result_type factor = result_type(1) /
+              (result_type((eng.max)()-(eng.min)()) +
+               result_type(std::numeric_limits<base_result>::is_integer ? 1 : 0));
+      result_type result = result_type(eng() - (eng.min)()) * factor;
+      if (result < result_type(1))
+        return result;
+    }
+  }
+
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
+  template<class CharT, class Traits>
+  friend std::basic_ostream<CharT,Traits>&
+  operator<<(std::basic_ostream<CharT,Traits>& os, const new_uniform_01&)
+  {
+    return os;
+  }
+
+  template<class CharT, class Traits>
+  friend std::basic_istream<CharT,Traits>&
+  operator>>(std::basic_istream<CharT,Traits>& is, new_uniform_01&)
+  {
+    return is;
+  }
+#endif
+};
+
+template<class UniformRandomNumberGenerator, class RealType>
+class backward_compatible_uniform_01
 {
+  typedef boost::random::detail::ptr_helper<UniformRandomNumberGenerator> traits;
+  typedef boost::random::detail::pass_through_engine<UniformRandomNumberGenerator> internal_engine_type;
 public:
   typedef UniformRandomNumberGenerator base_type;
   typedef RealType result_type;
@@ -39,7 +83,7 @@
   BOOST_STATIC_ASSERT(!std::numeric_limits<RealType>::is_integer);
 #endif
 
-  explicit uniform_01(base_type rng)
+  explicit backward_compatible_uniform_01(typename traits::rvalue_type rng)
     : _rng(rng),
       _factor(result_type(1) /
               (result_type((_rng.max)()-(_rng.min)()) +
@@ -50,22 +94,22 @@
 
   result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return result_type(0); }
   result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return result_type(1); }
-  base_type& base() { return _rng; }
-  const base_type& base() const { return _rng; }
+  typename traits::value_type& base() { return _rng.base(); }
+  const typename traits::value_type& base() const { return _rng.base(); }
   void reset() { }
 
   result_type operator()() {
     for (;;) {
       result_type result = result_type(_rng() - (_rng.min)()) * _factor;
       if (result < result_type(1))
-	return result;
+        return result;
     }
   }
 
 #if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
-  operator<<(std::basic_ostream<CharT,Traits>& os, const uniform_01& u)
+  operator<<(std::basic_ostream<CharT,Traits>& os, const backward_compatible_uniform_01& u)
   {
     os << u._rng;
     return os;
@@ -73,7 +117,7 @@
 
   template<class CharT, class Traits>
   friend std::basic_istream<CharT,Traits>&
-  operator>>(std::basic_istream<CharT,Traits>& is, uniform_01& u)
+  operator>>(std::basic_istream<CharT,Traits>& is, backward_compatible_uniform_01& u)
   {
     is >> u._rng;
     return is;
@@ -81,16 +125,95 @@
 #endif
 
 private:
-  typedef typename base_type::result_type base_result;
-  base_type _rng;
+  typedef typename internal_engine_type::result_type base_result;
+  internal_engine_type _rng;
   result_type _factor;
 };
 
 #ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
 //  A definition is required even for integral static constants
 template<class UniformRandomNumberGenerator, class RealType>
-const bool uniform_01<UniformRandomNumberGenerator, RealType>::has_fixed_range;
+const bool backward_compatible_uniform_01<UniformRandomNumberGenerator, RealType>::has_fixed_range;
+#endif
+
+template<class UniformRandomNumberGenerator>
+struct select_uniform_01
+{
+  template<class RealType>
+  struct apply
+  {
+    typedef backward_compatible_uniform_01<UniformRandomNumberGenerator, RealType> type;
+  };
+};
+
+template<>
+struct select_uniform_01<float>
+{
+  template<class RealType>
+  struct apply
+  {
+    typedef new_uniform_01<float> type;
+  };
+};
+
+template<>
+struct select_uniform_01<double>
+{
+  template<class RealType>
+  struct apply
+  {
+    typedef new_uniform_01<double> type;
+  };
+};
+
+template<>
+struct select_uniform_01<long double>
+{
+  template<class RealType>
+  struct apply
+  {
+    typedef new_uniform_01<long double> type;
+  };
+};
+
+}
+
+// Because it is so commonly used: uniform distribution on the real [0..1)
+// range.  This allows for specializations to avoid a costly int -> float
+// conversion plus float multiplication
+template<class UniformRandomNumberGenerator = double, class RealType = double>
+class uniform_01
+  : public detail::select_uniform_01<UniformRandomNumberGenerator>::BOOST_NESTED_TEMPLATE apply<RealType>::type
+{
+  typedef typename detail::select_uniform_01<UniformRandomNumberGenerator>::BOOST_NESTED_TEMPLATE apply<RealType>::type impl_type;
+  typedef boost::random::detail::ptr_helper<UniformRandomNumberGenerator> traits;
+public:
+
+  uniform_01() {}
+
+  explicit uniform_01(typename traits::rvalue_type rng)
+    : impl_type(rng)
+  {
+  }
+
+#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+  template<class CharT, class Traits>
+  friend std::basic_ostream<CharT,Traits>&
+  operator<<(std::basic_ostream<CharT,Traits>& os, const uniform_01& u)
+  {
+    os << static_cast<const impl_type&>(u);
+    return os;
+  }
+
+  template<class CharT, class Traits>
+  friend std::basic_istream<CharT,Traits>&
+  operator>>(std::basic_istream<CharT,Traits>& is, uniform_01& u)
+  {
+    is >> static_cast<impl_type&>(u);
+    return is;
+  }
 #endif
+};
 
 } // namespace boost
 
Modified: branches/release/boost/random/uniform_int.hpp
==============================================================================
--- branches/release/boost/random/uniform_int.hpp	(original)
+++ branches/release/boost/random/uniform_int.hpp	2009-04-19 10:55:57 EDT (Sun, 19 Apr 2009)
@@ -24,6 +24,7 @@
 #include <boost/static_assert.hpp>
 #include <boost/detail/workaround.hpp>
 #include <boost/random/uniform_smallint.hpp>
+#include <boost/random/detail/config.hpp>
 #include <boost/random/detail/signed_unsigned_tools.hpp>
 #include <boost/type_traits/make_unsigned.hpp>
 #ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
@@ -76,7 +77,7 @@
       return generate(eng, 0, n - 1, n - 1);
   }
 
-#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const uniform_int& ud)
@@ -89,13 +90,9 @@
   friend std::basic_istream<CharT,Traits>&
   operator>>(std::basic_istream<CharT,Traits>& is, uniform_int& ud)
   {
-# if BOOST_WORKAROUND(_MSC_FULL_VER, BOOST_TESTED_AT(13102292)) && BOOST_MSVC == 1400
-      return detail::extract_uniform_int(is, ud, ud.impl);
-# else
-   is >> std::ws >> ud._min >> std::ws >> ud._max;
+    is >> std::ws >> ud._min >> std::ws >> ud._max;
     ud.init();
     return is;
-# endif
   }
 #endif
 
Modified: branches/release/boost/random/uniform_on_sphere.hpp
==============================================================================
--- branches/release/boost/random/uniform_on_sphere.hpp	(original)
+++ branches/release/boost/random/uniform_on_sphere.hpp	2009-04-19 10:55:57 EDT (Sun, 19 Apr 2009)
@@ -19,6 +19,7 @@
 #include <vector>
 #include <algorithm>     // std::transform
 #include <functional>    // std::bind2nd, std::divides
+#include <boost/random/detail/config.hpp>
 #include <boost/random/normal_distribution.hpp>
 
 namespace boost {
@@ -56,7 +57,7 @@
     return _container;
   }
 
-#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const uniform_on_sphere& sd)
Modified: branches/release/boost/random/uniform_real.hpp
==============================================================================
--- branches/release/boost/random/uniform_real.hpp	(original)
+++ branches/release/boost/random/uniform_real.hpp	2009-04-19 10:55:57 EDT (Sun, 19 Apr 2009)
@@ -22,6 +22,7 @@
 #include <boost/config.hpp>
 #include <boost/limits.hpp>
 #include <boost/static_assert.hpp>
+#include <boost/random/detail/config.hpp>
 
 namespace boost {
 
@@ -56,7 +57,7 @@
            * (_max - _min) + _min;
   }
 
-#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const uniform_real& ud)
Modified: branches/release/boost/random/uniform_smallint.hpp
==============================================================================
--- branches/release/boost/random/uniform_smallint.hpp	(original)
+++ branches/release/boost/random/uniform_smallint.hpp	2009-04-19 10:55:57 EDT (Sun, 19 Apr 2009)
@@ -22,139 +22,14 @@
 #include <boost/config.hpp>
 #include <boost/limits.hpp>
 #include <boost/static_assert.hpp>
+#include <boost/random/detail/config.hpp>
 #include <boost/random/uniform_01.hpp>
 #include <boost/detail/workaround.hpp>
-#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
-#include <boost/type_traits/is_float.hpp>
-#endif
-
 
 namespace boost {
 
 // uniform integer distribution on a small range [min, max]
 
-namespace detail {
-
-template <class InputStream, class UniformInt, class Impl>
-InputStream& extract_uniform_int(InputStream& is, UniformInt& ud, Impl& impl)
-{
-    typename UniformInt::result_type min, max;
-    is >> std::ws >> min >> std::ws >> max;
-    impl.set(min, max);
-    return is;
-}
-
-template<class UniformRandomNumberGenerator, class IntType>
-struct uniform_smallint_integer
-{
-public:
-  typedef UniformRandomNumberGenerator base_type;
-  typedef IntType result_type;
-
-  uniform_smallint_integer(base_type & rng, IntType min_arg, IntType max_arg)
-    : _rng(&rng)
-  { set(min_arg, max_arg); }
-
-  void set(result_type min, result_type max);
-  
-  result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _min; }
-  result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _max; }
-  base_type& base() const { return *_rng; }
-  
-  result_type operator()()
-  {
-    // we must not use the low bits here, because LCGs get very bad then
-    return (((*_rng)() - (_rng->min)()) / _factor) % _range + _min;
-  }
-
-private:
-  typedef typename base_type::result_type base_result;
-  base_type * _rng;
-  IntType _min, _max;
-  base_result _range;
-  base_result _factor;
-};
-
-template<class UniformRandomNumberGenerator, class IntType>
-void uniform_smallint_integer<UniformRandomNumberGenerator, IntType>::
-set(result_type min_arg, result_type max_arg) 
-{
-  _min = min_arg;
-  _max = max_arg;
-  assert(min_arg <= max_arg);
-
-  _range = static_cast<base_result>(_max-_min)+1;
-  _factor = 1;
-  
-  // LCGs get bad when only taking the low bits.
-  // (probably put this logic into a partial template specialization)
-  // Check how many low bits we can ignore before we get too much
-  // quantization error.
-  base_result r_base = (_rng->max)() - (_rng->min)();
-  if(r_base == (std::numeric_limits<base_result>::max)()) {
-    _factor = 2;
-    r_base /= 2;
-  }
-  r_base += 1;
-  if(r_base % _range == 0) {
-    // No quantization effects, good
-    _factor = r_base / _range;
-  } else {
-    // carefully avoid overflow; pessimizing heree
-    for( ; r_base/_range/32 >= _range; _factor *= 2)
-      r_base /= 2;
-  }
-}
-
-template<class UniformRandomNumberGenerator, class IntType>
-class uniform_smallint_float
-{
-public:
-  typedef UniformRandomNumberGenerator base_type;
-  typedef IntType result_type;
-
-  uniform_smallint_float(base_type & rng, IntType min_arg, IntType max_arg)
-    : _rng(rng)
-  {
-    // MSVC fails BOOST_STATIC_ASSERT with std::numeric_limits at class scope
-#if !defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) && !(defined(BOOST_MSVC) && BOOST_MSVC <= 1300)
-    BOOST_STATIC_ASSERT(std::numeric_limits<IntType>::is_integer);
-    BOOST_STATIC_ASSERT(!std::numeric_limits<typename base_type::result_type>::is_integer);
-#endif
-
-    assert(min_arg <= max_arg);
-    set(min_arg, max_arg);
-  }
-
-  void set(result_type min_arg, result_type max_arg)
-  {
-    _min = min_arg;
-    _max = max_arg;
-    _range = static_cast<base_result>(_max-_min)+1;
-  }
-
-  result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _min; }
-  result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _max; }
-  base_type& base() const { return _rng.base(); }
-
-  result_type operator()()
-  {
-    return static_cast<IntType>(_rng() * _range) + _min;
-  }
-
-private:
-  typedef typename base_type::result_type base_result;
-  uniform_01<base_type> _rng;
-  IntType _min, _max;
-  base_result _range;
-};
-
-
-} // namespace detail
-
-
-
-
 template<class IntType = int>
 class uniform_smallint
 {
@@ -196,7 +71,7 @@
       // No quantization effects, good
       _factor = r_base / _range;
     } else {
-      // carefully avoid overflow; pessimizing heree
+      // carefully avoid overflow; pessimizing here
       for( ; r_base/_range/32 >= _range; _factor *= 2)
         r_base /= 2;
     }
@@ -204,7 +79,7 @@
     return ((eng() - (eng.min)()) / _factor) % _range + _min;
   }
 
-#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const uniform_smallint& ud)
@@ -217,16 +92,13 @@
   friend std::basic_istream<CharT,Traits>&
   operator>>(std::basic_istream<CharT,Traits>& is, uniform_smallint& ud)
   {
-# if BOOST_WORKAROUND(_MSC_FULL_VER, BOOST_TESTED_AT(13102292)) && BOOST_MSVC > 1300
-      return detail::extract_uniform_int(is, ud, ud._impl);
-# else
     is >> std::ws >> ud._min >> std::ws >> ud._max;
     return is;
-# endif
   }
 #endif
 
 private:
+
   result_type _min;
   result_type _max;
 };
Modified: branches/release/boost/random/xor_combine.hpp
==============================================================================
--- branches/release/boost/random/xor_combine.hpp	(original)
+++ branches/release/boost/random/xor_combine.hpp	2009-04-19 10:55:57 EDT (Sun, 19 Apr 2009)
@@ -21,18 +21,19 @@
 #include <boost/limits.hpp>
 #include <boost/static_assert.hpp>
 #include <boost/cstdint.hpp>     // uint32_t
+#include <boost/random/detail/config.hpp>
 
 
 namespace boost {
 namespace random {
 
-template<class URNG1, int s1, class URNG2, int s2,
 #ifndef BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS
-  typename URNG1::result_type 
+  #define BOOST_RANDOM_VAL_TYPE typename URNG1::result_type 
 #else
-  uint32_t
+  #define BOOST_RANDOM_VAL_TYPE uint32_t
 #endif
-  val = 0>
+
+template<class URNG1, int s1, class URNG2, int s2, BOOST_RANDOM_VAL_TYPE val = 0>
 class xor_combine
 {
 public:
@@ -42,7 +43,7 @@
 
   BOOST_STATIC_CONSTANT(bool, has_fixed_range = false);
   BOOST_STATIC_CONSTANT(int, shift1 = s1);
-  BOOST_STATIC_CONSTANT(int, shfit2 = s2);
+  BOOST_STATIC_CONSTANT(int, shift2 = s2);
 
   xor_combine() : _rng1(), _rng2()
   { }
@@ -77,7 +78,7 @@
 
 #ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
 
-#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const xor_combine& s)
@@ -114,16 +115,16 @@
 
 #ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
 //  A definition is required even for integral static constants
-template<class URNG1, int s1, class URNG2, int s2,
-#ifndef BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS
-  typename URNG1::result_type 
-#else
-  uint32_t
-#endif
-  val>
+template<class URNG1, int s1, class URNG2, int s2, BOOST_RANDOM_VAL_TYPE val>
 const bool xor_combine<URNG1, s1, URNG2, s2, val>::has_fixed_range;
+template<class URNG1, int s1, class URNG2, int s2, BOOST_RANDOM_VAL_TYPE val>
+const int xor_combine<URNG1, s1, URNG2, s2, val>::shift1;
+template<class URNG1, int s1, class URNG2, int s2, BOOST_RANDOM_VAL_TYPE val>
+const int xor_combine<URNG1, s1, URNG2, s2, val>::shift2;
 #endif
 
+#undef BOOST_RANDOM_VAL_TYPE
+
 } // namespace random
 } // namespace boost
 
Modified: branches/release/libs/random/index.html
==============================================================================
--- branches/release/libs/random/index.html	(original)
+++ branches/release/libs/random/index.html	2009-04-19 10:55:57 EDT (Sun, 19 Apr 2009)
@@ -47,7 +47,7 @@
   <pre>
   boost::mt19937 rng;                 // produces randomness out of thin air
                                       // see pseudo-random number generators
-  boost::uniform_int<> six(1,6)       // distribution that maps to 1..6
+  boost::uniform_int<> six(1,6);      // distribution that maps to 1..6
                                       // see random number distributions
   boost::variate_generator<boost::mt19937&, boost::uniform_int<> >
            die(rng, six);             // glues randomness with mapping
@@ -62,7 +62,7 @@
   available as <code><a href=
   "../../boost/random.hpp">boost/random.hpp</a></code>.</p>
 
-  <p>A front-end class template called <code>variate_generate</code> is
+  <p>A front-end class template called <code>variate_generator</code> is
   provided; please read the documentation
   about it.</p>
 
Modified: branches/release/libs/random/random_device.cpp
==============================================================================
--- branches/release/libs/random/random_device.cpp	(original)
+++ branches/release/libs/random/random_device.cpp	2009-04-19 10:55:57 EDT (Sun, 19 Apr 2009)
@@ -22,7 +22,7 @@
 #endif
 
 
-#ifdef __linux__
+#if defined(__linux__) || defined (__FreeBSD__)
 
 // the default is the unlimited capacity device, using some secure hash
 // try "/dev/random" for blocking when the entropy pool has drained
@@ -90,7 +90,7 @@
   int fd;
 };
 
-#endif // __linux__
+#endif // __linux__ || __FreeBSD__
 
 
 boost::random_device::random_device(const std::string& token)
Modified: branches/release/libs/random/random_test.cpp
==============================================================================
--- branches/release/libs/random/random_test.cpp	(original)
+++ branches/release/libs/random/random_test.cpp	2009-04-19 10:55:57 EDT (Sun, 19 Apr 2009)
@@ -40,347 +40,6 @@
  */
 
 /*
- * Validate correct implementation
- */
-
-// own run
-bool check(unsigned long x, const boost::mt11213b&) { return x == 3809585648U; }
-
-// validation by experiment from mt19937.c
-bool check(unsigned long x, const boost::mt19937&) { return x == 4123659995U; }
-
-// validation values from the publications
-bool check(int x, const boost::minstd_rand0&) { return x == 1043618065; }
-
-// validation values from the publications
-bool check(int x, const boost::minstd_rand&) { return x == 399268537; }
-
-#if !defined(BOOST_NO_INT64_T) && !defined(BOOST_NO_INTEGRAL_INT64_T)
-// by experiment from lrand48()
-bool check(unsigned long x, const boost::rand48&) { return x == 1993516219; }
-#endif
-
-// ????
-bool check(unsigned long x, const boost::taus88&) { return x == 3535848941U; }
-
-// ????
-bool check(int x, const boost::ecuyer1988&) { return x == 2060321752; }
-
-// validation by experiment from Harry Erwin's generator.h (private e-mail)
-bool check(unsigned int x, const boost::kreutzer1986&) { return x == 139726; }
-
-bool check(double x, const boost::lagged_fibonacci607&) { return std::abs(x-0.401269) < 1e-5; }
-
-// principal operation validated with CLHEP, values by experiment
-bool check(unsigned long x, const boost::ranlux3&) { return x == 5957620; }
-bool check(unsigned long x, const boost::ranlux4&) { return x == 8587295; }
-
-bool check(float x, const boost::ranlux3_01&)
-{ return std::abs(x-5957620/std::pow(2.0f,24)) < 1e-6; }
-bool check(float x, const boost::ranlux4_01&)
-{ return std::abs(x-8587295/std::pow(2.0f,24)) < 1e-6; }
-
-bool check(double x, const boost::ranlux64_3_01&)
-{ return std::abs(x-0.838413) < 1e-6; }
-bool check(double x, const boost::ranlux64_4_01&)
-{ return std::abs(x-0.59839) < 1e-6; }
-
-template<class PRNG>
-void validate(const std::string & name, const PRNG &)
-{
-  std::cout << "validating " << name << ": ";
-  PRNG rng;  // default ctor
-  for(int i = 0; i < 9999; i++)
-    rng();
-  typename PRNG::result_type val = rng();
-  // make sure the validation function is a static member
-  bool result = check(val, rng);
-  
-  // allow for a simple eyeball check for MSVC instantiation brokenness
-  // (if the numbers for all generators are the same, it's obviously broken)
-  std::cout << val << std::endl;
-  BOOST_CHECK(result);
-}
-
-void validate_all()
-{
-  using namespace boost;
-#if !defined(BOOST_NO_INT64_T) && !defined(BOOST_NO_INTEGRAL_INT64_T)
-  validate("rand48", rand48());
-#endif
-  validate("minstd_rand", minstd_rand());
-  validate("minstd_rand0", minstd_rand0());
-  validate("ecuyer combined", ecuyer1988());
-  validate("mt11213b", mt11213b());
-  validate("mt19937", mt19937());
-  validate("kreutzer1986", kreutzer1986());
-  validate("ranlux3", ranlux3());
-  validate("ranlux4", ranlux4());
-  validate("ranlux3_01", ranlux3_01());
-  validate("ranlux4_01", ranlux4_01());
-  validate("ranlux64_3_01", ranlux64_3_01());
-  validate("ranlux64_4_01", ranlux64_4_01());
-  validate("taus88", taus88());
-  validate("lagged_fibonacci607", lagged_fibonacci607());
-}
-
-
-/*
- * Check function signatures
- */
-
-#if BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT( 0x570) )
-#pragma warn -par
-#endif
-template<class URNG, class Dist>
-void instantiate_dist(URNG& urng, const char * name, const Dist& dist)
-{
-  // this makes a copy of urng
-  boost::variate_generator<URNG, Dist> gen(urng, dist);
-
-  // this keeps a reference to urng
-  boost::variate_generator<URNG&, Dist> genref(urng, dist);
-
-#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
-  // and here is a pointer to (a copy of) the urng
-  URNG copy = urng;
-  boost::variate_generator<URNG*, Dist> genptr(©, dist);
-#endif
-
-  for(int i = 0; i < 1000; ++i) {
-    (void) gen();
-    (void) genref();
-#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
-    (void) genptr();
-#endif
-  }
-  typename Dist::result_type g = gen();
-  BOOST_CHECK(std::abs(g - genref()) < 1e-6);
-#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
-  BOOST_CHECK(std::abs(g - genptr()) < 1e-6);
-#endif
-
-  (void) gen.engine();
-  gen.distribution().reset();
-
-  Dist d = dist;            // copy ctor
-  d = dist;                 // copy assignment
-
-#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
-  {
-    std::ostringstream file;
-    file << urng << std::endl;
-    file << d;
-    std::istringstream input(file.str());
-    // std::cout << file.str() << std::endl;
-    URNG restored_engine;
-    input >> restored_engine;
-    input >> std::ws;
-    Dist restored_dist;
-    input >> restored_dist;
-#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 // MSVC brokenness
-    boost::variate_generator<URNG, Dist> old(urng, d);
-    boost::variate_generator<URNG, Dist> restored(restored_engine, restored_dist);
-    // advance some more so that state is exercised
-    for(int i = 0; i < 1000; ++i) {
-      (void) old();
-      (void) restored();
-    }
-    BOOST_CHECK_MESSAGE((std::abs(old()-restored()) < 0.0001),
-                        (std::string(name) + " old == restored_dist"));
-#endif // BOOST_MSVC
-  }
-#endif // BOOST_NO_OPERATORS_IN_NAMESPACE
-}
-
-template<class URNG, class RealType>
-void instantiate_real_dist(URNG& urng, RealType /* ignored */)
-{
-  instantiate_dist(urng, "uniform_real",
-                   boost::uniform_real<RealType>(0, 2.1));
-  instantiate_dist(urng, "triangle_distribution",
-                   boost::triangle_distribution<RealType>(1, 1.5, 7));
-  instantiate_dist(urng, "exponential_distribution",
-                   boost::exponential_distribution<RealType>(5));
-  instantiate_dist(urng, "normal_distribution",
-                   boost::normal_distribution<RealType>());
-  instantiate_dist(urng, "lognormal_distribution",
-                   boost::lognormal_distribution<RealType>(1, 1));
-  instantiate_dist(urng, "cauchy_distribution",
-                   boost::cauchy_distribution<RealType>(1));
-  instantiate_dist(urng, "gamma_distribution",
-                   boost::gamma_distribution<RealType>(1));
-}
-
-template<class URNG, class ResultType>
-void instantiate_urng(const std::string & s, const URNG &, const ResultType &)
-{
-  std::cout << "Basic tests for " << s;
-  URNG urng;
-  urng.seed();                                  // seed() member function
-  int a[URNG::has_fixed_range ? 5 : 10];        // compile-time constant
-  (void) a;   // avoid "unused" warning
-  typename URNG::result_type x1 = urng();
-  ResultType x2 = x1;
-  (void) &x2;           // avoid "unused" warning
-
-  URNG urng2 = urng;             // copy constructor
-#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 // MSVC brokenness
-  BOOST_CHECK(urng == urng2);     // operator==
-  BOOST_CHECK(!(urng != urng2));  // operator!=
-  urng();
-  urng2 = urng;                  // copy assignment
-  BOOST_CHECK(urng == urng2);
-#endif // BOOST_MSVC
-
-  const std::vector<int> v(9999u, 0x41);
-  std::vector<int>::const_iterator it = v.begin();
-  std::vector<int>::const_iterator it_end = v.end();
-  URNG urng3(it, it_end);
-  BOOST_CHECK(it != v.begin());
-  std::cout << "; seeding uses " << (it - v.begin()) << " words" << std::endl;
-
-  bool have_exception = false;
-  try {
-    // now check that exceptions are thrown
-    it = v.end();
-    urng3.seed(it, it_end);
-  } catch(std::invalid_argument& x) {
-    have_exception = true;
-  }
-  BOOST_CHECK(have_exception);
-
-  // check for min/max members
-  ResultType min = (urng3.min)();
-  (void) &min;
-  ResultType max = (urng3.max)();
-  (void) &max;
-
-#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
-  // Streamable concept not supported for broken compilers
-
-  // advance a little so that state is relatively arbitrary
-  for(int i = 0; i < 9307; ++i)
-    urng();
-  urng2 = urng;
-
-  {
-    // narrow stream first
-    std::ostringstream file;
-    file << urng;
-    // move forward
-    urng();
-    // restore old state
-    std::istringstream input(file.str());
-    input >> urng;
-    // std::cout << file.str() << std::endl;
-#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 // MSVC brokenness
-    // advance some more so that state is exercised
-    for(int i = 0; i < 10000; ++i) {
-      urng();
-      urng2();
-    }
-    BOOST_CHECK(urng == urng2);
-#endif // BOOST_MSVC
-  }
-  
-  urng2 = urng;
-#if !defined(BOOST_NO_STD_WSTREAMBUF) && !defined(BOOST_NO_STD_WSTRING)
-  {
-    // then wide stream
-    std::wostringstream file;
-    file << urng;
-    // move forward
-    urng();
-    std::wistringstream input(file.str());
-    input >> urng;
-#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 // MSVC brokenness
-    // advance some more so that state is exercised
-    for(int i = 0; i < 10000; ++i) {
-      urng();
-      urng2();
-    }
-    BOOST_CHECK(urng == urng2);
-#endif // BOOST_MSVC
-  }
-#endif // BOOST_NO_STD_WSTREAMBUF, BOOST_NO_STD_WSTRING
-#endif // BOOST_NO_OPERATORS_IN_NAMESPACE etc.
-
-  // instantiate various distributions with this URNG
-  // instantiate_dist(urng, "uniform_smallint", boost::uniform_smallint(0, 11));
-  instantiate_dist(urng, "uniform_int", boost::uniform_int<>(-200, 20000));
-  instantiate_dist(urng, "bernoulli_distribution",
-                   boost::bernoulli_distribution<>(0.2));
-  instantiate_dist(urng, "binomial_distribution",
-                   boost::binomial_distribution<>(4, 0.2));
-  instantiate_dist(urng, "geometric_distribution",
-                   boost::geometric_distribution<>(0.8));
-  instantiate_dist(urng, "poisson_distribution",
-                   boost::poisson_distribution<>(1));
-
-  instantiate_real_dist(urng, 1.0f);
-  instantiate_real_dist(urng, 1.0);
-  instantiate_real_dist(urng, 1.0l);
-
-#if 0
-  // We cannot compare the outcomes before/after save with std::abs(x-y)
-  instantiate_dist("uniform_on_sphere",
-                   boost::uniform_on_sphere<URNG>(urng, 2));
-#endif
-}
-
-void instantiate_all()
-{
-  using namespace boost;
-
-#if !defined(BOOST_NO_INT64_T) && !defined(BOOST_NO_INTEGRAL_INT64_T)
-  instantiate_urng("rand48", rand48(), 0);
-  rand48 rnd(boost::int32_t(5));
-  rand48 rnd2(boost::uint64_t(0x80000000) * 42);
-  rnd.seed(boost::int32_t(17));
-  rnd2.seed(boost::uint64_t(0x80000000) * 49);
-#endif
-
-  instantiate_urng("minstd_rand0", minstd_rand0(), 0);
-  instantiate_urng("minstd_rand", minstd_rand(), 0);
-  minstd_rand mstd(42);
-  mstd.seed(17);
-
-  instantiate_urng("ecuyer1988", ecuyer1988(), 0);
-  instantiate_urng("kreutzer1986", kreutzer1986(), 0);
-  instantiate_urng("hellekalek1995", hellekalek1995(), 0);
-
-  instantiate_urng("mt11213b", mt11213b(), 0u);
-  instantiate_urng("mt19937", mt19937(), 0u);
-
-  mt19937 mt(boost::uint32_t(17));  // needs to be an exact type match for MSVC
-  int i = 42;
-  mt.seed(boost::uint32_t(i));
-  mt19937 mt2(mstd);
-  mt2.seed(mstd);
-
-
-  random_number_generator<mt19937> std_rng(mt2);
-  (void) std_rng(10);
-
-  instantiate_urng("lagged_fibonacci",
-                   boost::random::lagged_fibonacci<boost::uint32_t, 24, 607, 273>(),
-                   0u);
-  instantiate_urng("lagged_fibonacci607", lagged_fibonacci607(), 0.0);
-
-  instantiate_urng("ranlux3", ranlux3(), 0u);
-  instantiate_urng("ranlux4", ranlux4(), 0u);
-
-  instantiate_urng("ranlux3_01", ranlux3_01(), 0.0f);
-  instantiate_urng("ranlux4_01", ranlux4_01(), 0.0f);
-
-  instantiate_urng("ranlux64_3_01", ranlux64_3_01(), 0.0);
-  instantiate_urng("ranlux64_4_01", ranlux64_4_01(), 0.0);
-
-  instantiate_urng("taus88", taus88(), 0u);
-}
-
-/*
  * A few equidistribution tests
  */
 
@@ -570,8 +229,6 @@
 {
 
 #if !defined(__INTEL_COMPILER) || !defined(_MSC_VER) || __INTEL_COMPILER > 700 
-  instantiate_all();
-  validate_all();
   boost::mt19937 mt;
   test_uniform_int(mt);
 
Modified: branches/release/libs/random/test/Jamfile.v2
==============================================================================
--- branches/release/libs/random/test/Jamfile.v2	(original)
+++ branches/release/libs/random/test/Jamfile.v2	2009-04-19 10:55:57 EDT (Sun, 19 Apr 2009)
@@ -8,17 +8,42 @@
 import testing ;
 
 project
-    : source-location $(BOOST_ROOT)
+    : source-location ..
     ;
+
+run random_test.cpp ;
+run random_demo.cpp ;
+run validate.cpp ;
+
+local all-urngs = 
+    rand48
+    minstd_rand0
+    minstd_rand
+    ecuyer1988
+    kreutzer1986
+    hellekalek1995
+    mt11213b
+    mt19937
+    lagged_fibonacci
+    lagged_fibonacci607
+    ranlux3
+    ranlux4
+    ranlux3_01
+    ranlux4_01
+    ranlux64_3_01
+    ranlux64_4_01
+    taus88
+;
+
+for urng in $(all-urngs)
 {
-   test-suite "random"
-        :
-        [ run libs/random/random_test.cpp ]
-        [ run libs/random/random_demo.cpp ]
-#       [ run libs/random/nondet_random_speed.cpp ]
-#       [ run libs/random/random_device.cpp ]
-#       [ run libs/random/random_speed.cpp ]
-#       [ run libs/random/statistic_tests.cpp ]
-       ;
+    run instantiate.cpp : : : <define>BOOST_RANDOM_URNG_TEST=$(urng) : test_$(urng) ;
 }
 
+# run nondet_random_speed.cpp ;
+# run random_device.cpp ;
+# run random_speed.cpp ;
+# run statistic_tests.cpp ;
+
+
+