Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58649 - in branches/release: . boost boost/algorithm/string boost/archive boost/config boost/filesystem boost/functional/hash boost/fusion boost/graph boost/integer boost/interprocess boost/intrusive boost/math boost/numeric/ublas boost/program_options boost/property_tree boost/python boost/random boost/random/detail boost/regex boost/serialization boost/signals boost/signals2 boost/spirit boost/spirit/home boost/spirit/home/karma boost/spirit/home/support boost/system boost/thread boost/tr1 boost/type_traits boost/unordered boost/utility boost/variant boost/wave doc libs libs/config libs/filesystem libs/functional/hash libs/fusion libs/graph_parallel libs/integer libs/interprocess libs/intrusive libs/math libs/mpl/doc/refmanual libs/mpl/doc/src/refmanual libs/numeric/ublas libs/numeric/ublas/doc libs/program_options libs/property_tree libs/python libs/random libs/regex libs/regex/doc libs/serialization libs/signals libs/signals2 libs/spirit libs/spirit/classic/example libs/spirit/doc libs/spirit/example libs/spirit/phoenix libs/spirit/test libs/spirit/test/qi libs/static_assert libs/system libs/thread libs/thread/doc libs/timer libs/tr1 libs/type_traits libs/unordered libs/utility libs/wave more people status tools tools/boostbook tools/build/v2 tools/inspect tools/quickbook tools/regression tools/release tools/wave wiki
From: steven_at_[hidden]
Date: 2010-01-02 16:23:18


Author: steven_watanabe
Date: 2010-01-02 16:23:17 EST (Sat, 02 Jan 2010)
New Revision: 58649
URL: http://svn.boost.org/trac/boost/changeset/58649

Log:
Merge Random from the trunk. Fixes #3719
Added:
   branches/release/boost/random/detail/disable_warnings.hpp
      - copied unchanged from r57008, /trunk/boost/random/detail/disable_warnings.hpp
   branches/release/boost/random/detail/enable_warnings.hpp
      - copied unchanged from r57008, /trunk/boost/random/detail/enable_warnings.hpp
Properties modified:
   branches/release/ (props changed)
   branches/release/CMakeLists.txt (props changed)
   branches/release/INSTALL (props changed)
   branches/release/Jamroot (props changed)
   branches/release/LICENSE_1_0.txt (props changed)
   branches/release/boost/ (props changed)
   branches/release/boost-build.jam (props changed)
   branches/release/boost.css (props changed)
   branches/release/boost.png (props changed)
   branches/release/boost/algorithm/string/ (props changed)
   branches/release/boost/archive/ (props changed)
   branches/release/boost/config/ (props changed)
   branches/release/boost/filesystem/ (props changed)
   branches/release/boost/functional/hash/ (props changed)
   branches/release/boost/fusion/ (props changed)
   branches/release/boost/graph/ (props changed)
   branches/release/boost/integer/ (props changed)
   branches/release/boost/interprocess/ (props changed)
   branches/release/boost/intrusive/ (props changed)
   branches/release/boost/math/ (props changed)
   branches/release/boost/numeric/ublas/ (props changed)
   branches/release/boost/program_options/ (props changed)
   branches/release/boost/property_tree/ (props changed)
   branches/release/boost/python/ (props changed)
   branches/release/boost/regex/ (props changed)
   branches/release/boost/serialization/ (props changed)
   branches/release/boost/signals/ (props changed)
   branches/release/boost/signals2/ (props changed)
   branches/release/boost/spirit/ (props changed)
   branches/release/boost/spirit/home/ (props changed)
   branches/release/boost/spirit/home/karma/ (props changed)
   branches/release/boost/spirit/home/support/attributes.hpp (props changed)
   branches/release/boost/system/ (props changed)
   branches/release/boost/thread/ (props changed)
   branches/release/boost/thread.hpp (props changed)
   branches/release/boost/tr1/ (props changed)
   branches/release/boost/type_traits/ (props changed)
   branches/release/boost/unordered/ (props changed)
   branches/release/boost/utility/value_init.hpp (props changed)
   branches/release/boost/variant/ (props changed)
   branches/release/boost/version.hpp (props changed)
   branches/release/boost/wave/ (props changed)
   branches/release/bootstrap.bat (props changed)
   branches/release/bootstrap.sh (props changed)
   branches/release/doc/ (props changed)
   branches/release/index.htm (props changed)
   branches/release/index.html (props changed)
   branches/release/libs/ (props changed)
   branches/release/libs/config/ (props changed)
   branches/release/libs/filesystem/ (props changed)
   branches/release/libs/functional/hash/ (props changed)
   branches/release/libs/fusion/ (props changed)
   branches/release/libs/graph_parallel/ (props changed)
   branches/release/libs/integer/ (props changed)
   branches/release/libs/interprocess/ (props changed)
   branches/release/libs/intrusive/ (props changed)
   branches/release/libs/libraries.htm (props changed)
   branches/release/libs/maintainers.txt (props changed)
   branches/release/libs/math/ (props changed)
   branches/release/libs/mpl/doc/refmanual/broken-compiler-workarounds.html (props changed)
   branches/release/libs/mpl/doc/refmanual/categorized-index-concepts.html (props changed)
   branches/release/libs/mpl/doc/refmanual/cfg-no-preprocessed-headers.html (props changed)
   branches/release/libs/mpl/doc/refmanual/composition-and-argument-binding.html (props changed)
   branches/release/libs/mpl/doc/refmanual/data-types-concepts.html (props changed)
   branches/release/libs/mpl/doc/refmanual/data-types-miscellaneous.html (props changed)
   branches/release/libs/mpl/doc/refmanual/extensible-associative-sequence.html (props changed)
   branches/release/libs/mpl/doc/refmanual/inserter-class.html (props changed)
   branches/release/libs/mpl/doc/refmanual/tag-dispatched-metafunction.html (props changed)
   branches/release/libs/mpl/doc/refmanual/trivial-metafunctions-summary.html (props changed)
   branches/release/libs/mpl/doc/src/refmanual/Iterators-Iterator.rst (props changed)
   branches/release/libs/numeric/ublas/ (props changed)
   branches/release/libs/numeric/ublas/doc/ (props changed)
   branches/release/libs/program_options/ (props changed)
   branches/release/libs/property_tree/ (props changed)
   branches/release/libs/python/ (props changed)
   branches/release/libs/regex/ (props changed)
   branches/release/libs/regex/doc/ (props changed)
   branches/release/libs/serialization/ (props changed)
   branches/release/libs/signals/ (props changed)
   branches/release/libs/signals2/ (props changed)
   branches/release/libs/spirit/ (props changed)
   branches/release/libs/spirit/classic/example/ (props changed)
   branches/release/libs/spirit/doc/ (props changed)
   branches/release/libs/spirit/example/ (props changed)
   branches/release/libs/spirit/phoenix/ (props changed)
   branches/release/libs/spirit/test/ (props changed)
   branches/release/libs/spirit/test/qi/optional.cpp (props changed)
   branches/release/libs/static_assert/ (props changed)
   branches/release/libs/system/ (props changed)
   branches/release/libs/thread/ (props changed)
   branches/release/libs/thread/doc/ (props changed)
   branches/release/libs/timer/ (props changed)
   branches/release/libs/tr1/ (props changed)
   branches/release/libs/type_traits/ (props changed)
   branches/release/libs/unordered/ (props changed)
   branches/release/libs/utility/swap.html (props changed)
   branches/release/libs/utility/value_init.htm (props changed)
   branches/release/libs/utility/value_init_test.cpp (props changed)
   branches/release/libs/wave/ (props changed)
   branches/release/more/ (props changed)
   branches/release/people/ (props changed)
   branches/release/rst.css (props changed)
   branches/release/status/ (props changed)
   branches/release/tools/ (props changed)
   branches/release/tools/boostbook/ (props changed)
   branches/release/tools/build/v2/ (props changed)
   branches/release/tools/inspect/ (props changed)
   branches/release/tools/quickbook/ (props changed)
   branches/release/tools/regression/ (props changed)
   branches/release/tools/release/ (props changed)
   branches/release/tools/wave/ (props changed)
   branches/release/wiki/ (props changed)
Text files modified:
   branches/release/boost/random.hpp | 3 +
   branches/release/boost/random/additive_combine.hpp | 10 +-
   branches/release/boost/random/detail/const_mod.hpp | 4 +
   branches/release/boost/random/detail/pass_through_engine.hpp | 4 +
   branches/release/boost/random/linear_congruential.hpp | 37 ++++++++----
   branches/release/boost/random/linear_feedback_shift.hpp | 7 ++
   branches/release/boost/random/uniform_01.hpp | 4 +
   branches/release/boost/random/uniform_int.hpp | 2
   branches/release/boost/random/variate_generator.hpp | 4 +
   branches/release/libs/random/instantiate.cpp | 113 ++++++++++++++++++++++++++++-----------
   branches/release/libs/random/random-generators.html | 58 ++++++++++++++++++-
   11 files changed, 187 insertions(+), 59 deletions(-)

Modified: branches/release/boost/random.hpp
==============================================================================
--- branches/release/boost/random.hpp (original)
+++ branches/release/boost/random.hpp 2010-01-02 16:23:17 EST (Sat, 02 Jan 2010)
@@ -42,6 +42,9 @@
 #include <boost/random/ranlux.hpp>
 #include <boost/random/linear_feedback_shift.hpp>
 #include <boost/random/xor_combine.hpp>
+#include <boost/random/discard_block.hpp>
+#include <boost/random/subtract_with_carry.hpp>
+#include <boost/random/variate_generator.hpp>
 
 namespace boost {
   typedef random::xor_combine<random::xor_combine<random::linear_feedback_shift<uint32_t, 32, 31, 13, 12, 0>, 0,

Modified: branches/release/boost/random/additive_combine.hpp
==============================================================================
--- branches/release/boost/random/additive_combine.hpp (original)
+++ branches/release/boost/random/additive_combine.hpp 2010-01-02 16:23:17 EST (Sat, 02 Jan 2010)
@@ -54,8 +54,8 @@
   additive_combine(typename MLCG1::result_type seed1,
                    typename MLCG2::result_type seed2)
     : _mlcg1(seed1), _mlcg2(seed2) { }
- additive_combine(result_type seed)
- : _mlcg1(seed), _mlcg2(seed) { }
+ additive_combine(result_type aseed)
+ : _mlcg1(aseed), _mlcg2(aseed) { }
   template<class It> additive_combine(It& first, It last)
     : _mlcg1(first, last), _mlcg2(first, last) { }
 
@@ -65,10 +65,10 @@
     _mlcg2.seed();
   }
 
- void seed(result_type seed)
+ void seed(result_type aseed)
   {
- _mlcg1.seed(seed);
- _mlcg2.seed(seed);
+ _mlcg1.seed(aseed);
+ _mlcg2.seed(aseed);
   }
 
   void seed(typename MLCG1::result_type seed1,

Modified: branches/release/boost/random/detail/const_mod.hpp
==============================================================================
--- branches/release/boost/random/detail/const_mod.hpp (original)
+++ branches/release/boost/random/detail/const_mod.hpp 2010-01-02 16:23:17 EST (Sat, 02 Jan 2010)
@@ -22,6 +22,8 @@
 #include <boost/integer_traits.hpp>
 #include <boost/detail/workaround.hpp>
 
+#include <boost/random/detail/disable_warnings.hpp>
+
 namespace boost {
 namespace random {
 
@@ -356,4 +358,6 @@
 } // namespace random
 } // namespace boost
 
+#include <boost/random/detail/enable_warnings.hpp>
+
 #endif // BOOST_RANDOM_CONST_MOD_HPP

Modified: branches/release/boost/random/detail/pass_through_engine.hpp
==============================================================================
--- branches/release/boost/random/detail/pass_through_engine.hpp (original)
+++ branches/release/boost/random/detail/pass_through_engine.hpp 2010-01-02 16:23:17 EST (Sat, 02 Jan 2010)
@@ -16,7 +16,7 @@
 
 #include <boost/config.hpp>
 #include <boost/random/detail/ptr_helper.hpp>
-
+#include <boost/random/detail/disable_warnings.hpp>
 
 namespace boost {
 namespace random {
@@ -94,5 +94,7 @@
 } // namespace random
 } // namespace boost
 
+#include <boost/random/detail/enable_warnings.hpp>
+
 #endif // BOOST_RANDOM_DETAIL_PASS_THROUGH_ENGINE_HPP
 

Modified: branches/release/boost/random/linear_congruential.hpp
==============================================================================
--- branches/release/boost/random/linear_congruential.hpp (original)
+++ branches/release/boost/random/linear_congruential.hpp 2010-01-02 16:23:17 EST (Sat, 02 Jan 2010)
@@ -26,6 +26,8 @@
 #include <boost/random/detail/const_mod.hpp>
 #include <boost/detail/workaround.hpp>
 
+#include <boost/random/detail/disable_warnings.hpp>
+
 namespace boost {
 namespace random {
 
@@ -52,12 +54,8 @@
   // BOOST_STATIC_ASSERT(m == 0 || c < m);
 
   explicit linear_congruential(IntType x0 = 1)
- : _modulus(modulus), _x(_modulus ? (x0 % _modulus) : x0)
   {
- assert(c || x0); /* if c == 0 and x(0) == 0 then x(n) = 0 for all n */
- // overflow check
- // disabled because it gives spurious "divide by zero" gcc warnings
- // assert(m == 0 || (a*(m-1)+c) % m == (c < a ? c-a+m : c-a));
+ seed(x0);
 
     // MSVC fails BOOST_STATIC_ASSERT with std::numeric_limits at class scope
 #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
@@ -67,7 +65,6 @@
 
   template<class It>
   linear_congruential(It& first, It last)
- : _modulus(modulus)
   {
       seed(first, last);
   }
@@ -75,8 +72,22 @@
   // compiler-generated copy constructor and assignment operator are fine
   void seed(IntType x0 = 1)
   {
- assert(c || x0);
- _x = (_modulus ? (x0 % _modulus) : x0);
+ // wrap _x if it doesn't fit in the destination
+ if(modulus == 0) {
+ _x = x0;
+ } else {
+ _x = x0 % modulus;
+ }
+ // handle negative seeds
+ if(_x <= 0 && _x != 0) {
+ _x += modulus;
+ }
+ // adjust to the correct range
+ if(increment == 0 && _x == 0) {
+ _x = 1;
+ }
+ assert(_x >= (min)());
+ assert(_x <= (max)());
   }
 
   template<class It>
@@ -84,8 +95,7 @@
   {
     if(first == last)
       throw std::invalid_argument("linear_congruential::seed");
- IntType value = *first++;
- _x = (_modulus ? (value % _modulus) : value);
+ seed(*first++);
   }
 
   result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return c == 0 ? 1 : 0; }
@@ -135,8 +145,7 @@
 private:
 #endif
 #endif
-
- IntType _modulus; // work-around for gcc "divide by zero" warning in ctor
+
   IntType _x;
 };
 
@@ -259,7 +268,7 @@
     if(sizeof(T) < sizeof(uint64_t)) {
       return (static_cast<uint64_t>(x) << 16) | 0x330e;
     } else {
- return(static_cast<uint64_t>(x));
+ return(static_cast<uint64_t>(x));
     }
   }
   static uint64_t cnv(float x) { return(static_cast<uint64_t>(x)); }
@@ -270,4 +279,6 @@
 
 } // namespace boost
 
+#include <boost/random/detail/enable_warnings.hpp>
+
 #endif // BOOST_RANDOM_LINEAR_CONGRUENTIAL_HPP

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 2010-01-02 16:23:17 EST (Sat, 02 Jan 2010)
@@ -77,7 +77,12 @@
     seed(first, last);
   }
 
- void seed(UIntType s0 = 341) { assert(s0 >= (1 << (w-k))); value = s0; }
+ void seed(UIntType s0 = 341) {
+ if(s0 < (1 << (w-k))) {
+ s0 += 1 << (w-k);
+ }
+ value = s0;
+ }
   template<class It> void seed(It& first, It last)
   {
     if(first == last)

Modified: branches/release/boost/random/uniform_01.hpp
==============================================================================
--- branches/release/boost/random/uniform_01.hpp (original)
+++ branches/release/boost/random/uniform_01.hpp 2010-01-02 16:23:17 EST (Sat, 02 Jan 2010)
@@ -23,6 +23,8 @@
 #include <boost/random/detail/config.hpp>
 #include <boost/random/detail/pass_through_engine.hpp>
 
+#include <boost/random/detail/disable_warnings.hpp>
+
 namespace boost {
 
 namespace detail {
@@ -217,4 +219,6 @@
 
 } // namespace boost
 
+#include <boost/random/detail/enable_warnings.hpp>
+
 #endif // BOOST_RANDOM_UNIFORM_01_HPP

Modified: branches/release/boost/random/uniform_int.hpp
==============================================================================
--- branches/release/boost/random/uniform_int.hpp (original)
+++ branches/release/boost/random/uniform_int.hpp 2010-01-02 16:23:17 EST (Sat, 02 Jan 2010)
@@ -94,7 +94,7 @@
 
 private:
   template<class Engine>
- static result_type generate(Engine& eng, result_type min_value, result_type max_value, range_type range)
+ static result_type generate(Engine& eng, result_type min_value, result_type /*max_value*/, range_type range)
   {
     typedef typename Engine::result_type base_result;
     // ranges are always unsigned

Modified: branches/release/boost/random/variate_generator.hpp
==============================================================================
--- branches/release/boost/random/variate_generator.hpp (original)
+++ branches/release/boost/random/variate_generator.hpp 2010-01-02 16:23:17 EST (Sat, 02 Jan 2010)
@@ -29,6 +29,8 @@
 #include <boost/type_traits/is_integral.hpp>
 #endif
 
+#include <boost/random/detail/disable_warnings.hpp>
+
 namespace boost {
 
 namespace random {
@@ -130,4 +132,6 @@
 
 } // namespace boost
 
+#include <boost/random/detail/disable_warnings.hpp>
+
 #endif // BOOST_RANDOM_RANDOM_GENERATOR_HPP

Modified: branches/release/libs/random/instantiate.cpp
==============================================================================
--- branches/release/libs/random/instantiate.cpp (original)
+++ branches/release/libs/random/instantiate.cpp 2010-01-02 16:23:17 EST (Sat, 02 Jan 2010)
@@ -133,59 +133,106 @@
                    boost::gamma_distribution<RealType>(1));
 }
 
-template<class URNG, class T>
-void test_seed(URNG & urng, const T & t) {
- URNG urng2(t);
- BOOST_CHECK(urng == urng2);
- urng2.seed(t);
- BOOST_CHECK(urng == urng2);
+template<class URNG, class T, class Converted>
+void test_seed_conversion(URNG & urng, const T & t, const Converted &) {
+ Converted c = static_cast<Converted>(t);
+ if(static_cast<T>(c) == t) {
+ URNG urng2(c);
+ std::ostringstream msg;
+ msg << "Testing seed: type " << typeid(Converted).name() << ", value " << c;
+ BOOST_CHECK_MESSAGE(urng == urng2, msg.str());
+ urng2.seed(c);
+ BOOST_CHECK_MESSAGE(urng == urng2, msg.str());
+ }
 }
 
 // rand48 uses non-standard seeding
-template<class T>
-void test_seed(boost::rand48 & urng, const T & t) {
+template<class T, class Converted>
+void test_seed_conversion(boost::rand48 & urng, const T & t, const Converted &) {
     boost::rand48 urng2(t);
     urng2.seed(t);
 }
 
 template<class URNG, class ResultType>
-void instantiate_seed(const URNG &, const ResultType &) {
+void test_seed(const URNG &, const ResultType & value) {
+ URNG urng(value);
+
+ // integral types
+ test_seed_conversion(urng, value, static_cast<char>(0));
+ test_seed_conversion(urng, value, static_cast<signed char>(0));
+ test_seed_conversion(urng, value, static_cast<unsigned char>(0));
+ test_seed_conversion(urng, value, static_cast<short>(0));
+ test_seed_conversion(urng, value, static_cast<unsigned short>(0));
+ test_seed_conversion(urng, value, static_cast<int>(0));
+ test_seed_conversion(urng, value, static_cast<unsigned int>(0));
+ test_seed_conversion(urng, value, static_cast<long>(0));
+ test_seed_conversion(urng, value, static_cast<unsigned long>(0));
+#if !defined(BOOST_NO_INT64_T)
+ test_seed_conversion(urng, value, static_cast<boost::int64_t>(0));
+ test_seed_conversion(urng, value, static_cast<boost::uint64_t>(0));
+#endif
+
+ // floating point types
+ test_seed_conversion(urng, value, static_cast<float>(0));
+ test_seed_conversion(urng, value, static_cast<double>(0));
+ test_seed_conversion(urng, value, static_cast<long double>(0));
+}
+
+template<class URNG, class ResultType>
+void instantiate_seed(const URNG & urng, const ResultType &) {
     {
         URNG urng;
         URNG urng2;
         urng2.seed();
         BOOST_CHECK(urng == urng2);
     }
- {
- int value = 127;
- URNG urng(value);
-
- // integral types
- test_seed(urng, static_cast<char>(value));
- test_seed(urng, static_cast<signed char>(value));
- test_seed(urng, static_cast<unsigned char>(value));
- test_seed(urng, static_cast<short>(value));
- test_seed(urng, static_cast<unsigned short>(value));
- test_seed(urng, static_cast<int>(value));
- test_seed(urng, static_cast<unsigned int>(value));
- test_seed(urng, static_cast<long>(value));
- test_seed(urng, static_cast<unsigned long>(value));
-#if !defined(BOOST_NO_INT64_T)
- test_seed(urng, static_cast<boost::int64_t>(value));
- test_seed(urng, static_cast<boost::uint64_t>(value));
+ test_seed(urng, static_cast<ResultType>(0));
+ test_seed(urng, static_cast<ResultType>(127));
+ test_seed(urng, static_cast<ResultType>(539157235));
+ test_seed(urng, static_cast<ResultType>(~0u));
+}
+
+// ranlux uses int32_t for seeding instead of result_type
+template<class ResultType>
+void instantiate_seed(const boost::ranlux3 & urng, const ResultType &) {
+ instantiate_seed<boost::ranlux3, boost::uint32_t>(urng, ResultType());
+}
+template<class ResultType>
+void instantiate_seed(const boost::ranlux4 & urng, const ResultType &) {
+ instantiate_seed<boost::ranlux4, boost::uint32_t>(urng, ResultType());
+}
+template<class ResultType>
+void instantiate_seed(const boost::ranlux3_01 & urng, const ResultType &) {
+ instantiate_seed<boost::ranlux3_01, boost::uint32_t>(urng, ResultType());
+}
+template<class ResultType>
+void instantiate_seed(const boost::ranlux4_01 & urng, const ResultType &) {
+ instantiate_seed<boost::ranlux4_01, boost::uint32_t>(urng, ResultType());
+}
+#if !defined(BOOST_NO_INT64_T) && !defined(BOOST_NO_INTEGRAL_INT64_T)
+template<class ResultType>
+void instantiate_seed(const boost::ranlux64_3 & urng, const ResultType &) {
+ instantiate_seed<boost::ranlux64_3, boost::uint32_t>(urng, ResultType());
+}
+template<class ResultType>
+void instantiate_seed(const boost::ranlux64_4 & urng, const ResultType &) {
+ instantiate_seed<boost::ranlux64_3, boost::uint32_t>(urng, ResultType());
+}
 #endif
-
- // floating point types
- test_seed(urng, static_cast<float>(value));
- test_seed(urng, static_cast<double>(value));
- test_seed(urng, static_cast<long double>(value));
- }
+template<class ResultType>
+void instantiate_seed(const boost::ranlux64_3_01 & urng, const ResultType &) {
+ instantiate_seed<boost::ranlux64_3_01, boost::uint32_t>(urng, ResultType());
+}
+template<class ResultType>
+void instantiate_seed(const boost::ranlux64_4_01 & urng, const ResultType &) {
+ instantiate_seed<boost::ranlux64_4_01, boost::uint32_t>(urng, ResultType());
 }
 
+
 template<class URNG, class ResultType>
 void instantiate_urng(const std::string & s, const URNG & u, const ResultType & r)
 {
- std::cout << "Basic tests for " << s;
+ std::cout << "Basic tests for " << s << std::endl;
   URNG urng;
   instantiate_seed(u, r); // seed() member function
   int a[URNG::has_fixed_range ? 5 : 10]; // compile-time constant

Modified: branches/release/libs/random/random-generators.html
==============================================================================
--- branches/release/libs/random/random-generators.html (original)
+++ branches/release/libs/random/random-generators.html 2010-01-02 16:23:17 EST (Sat, 02 Jan 2010)
@@ -495,13 +495,20 @@
 </pre>
 
   <p><strong>Effects:</strong> Constructs a <code>linear_congruential</code>
- generator with x(0) := <code>x0</code>.</p>
+ generator, seeding it with <code>x0</code>.</p>
+
   <pre>
 void seed(IntType x0)
 </pre>
 
- <p><strong>Effects:</strong> Changes the current value x(n) of the
- generator to <code>x0</code>.</p>
+
+ <p><strong>Effects:</strong> If <code>c</code> mod <code>m</code> is zero
+ and <code>x0</code> mod <code>m</code> is zero, changes the current value of
+ the generator to 1. Otherwise, changes it to <code>x0</code> mod
+ <code>m</code>. If <code>c</code> is zero, distinct seeds in the range
+ [1,m) will leave the generator in distinct states. If <code>c</code>
+ is not zero, the range is [0,m).
+ </p>
 
   <h3><a name="minstd_rand" id="minstd_rand">Specializations</a></h3>
 
@@ -605,8 +612,13 @@
   static const result_type min_value = 1;
   static const result_type max_value = MLCG1::max_value-1;
   additive_combine();
+ additive_combine(typename MLCG1::result_type seed);
   additive_combine(typename MLCG1::result_type seed1,
                    typename MLCG2::result_type seed2);
+ void seed();
+ void seed(typename MLCG1::result_type seed);
+ void seed(typename MLCG1::result_type seed1,
+ typename MLCG2::result_type seed2);
   result_type operator()();
   bool validation(result_type x) const;
 };
@@ -645,6 +657,15 @@
 
   <p><strong>Effects:</strong> Constructs an <code>additive_combine</code>
   generator using the default constructors of the two base generators.</p>
+
+ <pre>
+additive_combine(typename MLCG1::result_type seed)
+</pre>
+
+ <p><strong>Effects:</strong> Constructs an <code>additive_combine</code>
+ generator, using <code>seed</code> as the constructor argument for
+ both base generators.</p>
+
   <pre>
 additive_combine(typename MLCG1::result_type seed1,
                  typename MLCG2::result_type seed2)
@@ -655,6 +676,30 @@
   constructor argument to the first and second base generator,
   respectively.</p>
 
+ <pre>
+void seed()
+</pre>
+
+ <p><strong>Effects:</strong> Seeds an <code>additive_combine</code>
+ generator using the default seeds of the two base generators.</p>
+
+ <pre>
+void seed(typename MLCG1::result_type seed)
+</pre>
+
+ <p><strong>Effects:</strong> Seeds an <code>additive_combine</code>
+ generator, using <code>seed</code> as the seed for both base
+ generators.</p>
+
+ <pre>
+void seed(typename MLCG1::result_type seed1,
+ typename MLCG2::result_type seed2)
+</pre>
+
+ <p><strong>Effects:</strong> Seeds an <code>additive_combine</code>
+ generator, using <code>seed1</code> and <code>seed2</code> as the
+ seeds to the first and second base generator, respectively.</p>
+
   <h3><a name="ecuyer1988" id="ecuyer1988">Specialization</a></h3>
 
   <p>The specialization <code>ecuyer1988</code> was suggested in the above
@@ -997,7 +1042,7 @@
 
   <h3>Description</h3>
 
- <p>Instantiations of class template <code>lagged_fibonacci</code> model a
+ <p>Instantiations of class template <code>lagged_fibonacci_01</code> model a
   <a href="random-concepts.html#pseudo-rng">pseudo-random number
   generator</a>. It uses a lagged Fibonacci algorithm with two lags p and q,
   evaluated in floating-point arithmetic: x(i) = x(i-p) + x(i-q) (mod 1) with
@@ -1050,7 +1095,10 @@
 
   <p><strong>Effects:</strong> Constructs a <code>minstd_rand0</code>
   generator with the constructor parameter <code>value</code> and calls
- <code>seed</code> with it.</p>
+ <code>seed</code> with it. Distinct seeds in the range [1, 2147483647)
+ will produce generators with different states. Other seeds will be
+ equivalent to some seed within this range. See
+ linear_congruential for details.</p>
   <pre>
 template&lt;class Generator&gt; void seed(Generator &amp; gen)
 </pre>


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk