Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r68428 - in trunk: boost/random libs/random/test
From: steven_at_[hidden]
Date: 2011-01-24 20:17:54


Author: steven_watanabe
Date: 2011-01-24 20:17:50 EST (Mon, 24 Jan 2011)
New Revision: 68428
URL: http://svn.boost.org/trac/boost/changeset/68428

Log:
Update triangle_distribution to match C++0x.
Added:
   trunk/libs/random/test/test_triangle.cpp (contents, props changed)
   trunk/libs/random/test/test_triangle_distribution.cpp (contents, props changed)
Text files modified:
   trunk/boost/random/triangle_distribution.hpp | 262 ++++++++++++++++++++++++++++-----------
   trunk/libs/random/test/Jamfile.v2 | 2
   trunk/libs/random/test/test_distribution.ipp | 64 +++++++++
   trunk/libs/random/test/test_real_distribution.ipp | 14 +
   4 files changed, 261 insertions(+), 81 deletions(-)

Modified: trunk/boost/random/triangle_distribution.hpp
==============================================================================
--- trunk/boost/random/triangle_distribution.hpp (original)
+++ trunk/boost/random/triangle_distribution.hpp 2011-01-24 20:17:50 EST (Mon, 24 Jan 2011)
@@ -1,6 +1,7 @@
 /* boost random/triangle_distribution.hpp header file
  *
  * Copyright Jens Maurer 2000-2001
+ * Copyright Steven Watanabe 2011
  * Distributed under the Boost Software License, Version 1.0. (See
  * accompanying file LICENSE_1_0.txt or copy at
  * http://www.boost.org/LICENSE_1_0.txt)
@@ -18,10 +19,15 @@
 
 #include <boost/config/no_tr1/cmath.hpp>
 #include <cassert>
+#include <iosfwd>
+#include <ios>
+#include <istream>
 #include <boost/random/detail/config.hpp>
+#include <boost/random/detail/operators.hpp>
 #include <boost/random/uniform_01.hpp>
 
 namespace boost {
+namespace random {
 
 /**
  * Instantiations of @c triangle_distribution model a \random_distribution.
@@ -33,86 +39,194 @@
 class triangle_distribution
 {
 public:
- typedef RealType input_type;
- typedef RealType result_type;
+ typedef RealType input_type;
+ typedef RealType result_type;
 
- /**
- * Constructs a @c triangle_distribution with the parameters
- * @c a, @c b, and @c c.
- *
- * Preconditions: a <= b <= c.
- */
- explicit triangle_distribution(result_type a_arg = result_type(0.0),
- result_type b_arg = result_type(0.5),
- result_type c_arg = result_type(1.0))
- : _a(a_arg), _b(b_arg), _c(c_arg)
- {
- assert(_a <= _b && _b <= _c);
- init();
- }
-
- // compiler-generated copy ctor and assignment operator are fine
-
- /** Returns the @c a parameter of the distribution */
- result_type a() const { return _a; }
- /** Returns the @c b parameter of the distribution */
- result_type b() const { return _b; }
- /** Returns the @c c parameter of the distribution */
- result_type c() const { return _c; }
-
- void reset() { }
-
- template<class Engine>
- result_type operator()(Engine& eng)
- {
-#ifndef BOOST_NO_STDC_NAMESPACE
- using std::sqrt;
-#endif
- result_type u = eng();
- if( u <= q1 )
- return _a + p1*sqrt(u);
- else
- return _c - d3*sqrt(d2*u-d1);
- }
-
-#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)
- {
- os << td._a << " " << td._b << " " << td._c;
- return os;
- }
-
- template<class CharT, class Traits>
- friend std::basic_istream<CharT,Traits>&
- operator>>(std::basic_istream<CharT,Traits>& is, triangle_distribution& td)
- {
- is >> std::ws >> td._a >> std::ws >> td._b >> std::ws >> td._c;
- td.init();
- return is;
- }
-#endif
+ class param_type
+ {
+ public:
+
+ typedef triangle_distribution distribution_type;
+
+ /** Constructs the parameters of a @c triangle_distribution. */
+ explicit param_type(RealType a_arg = RealType(0.0),
+ RealType b_arg = RealType(0.5),
+ RealType c_arg = RealType(1.0))
+ : _a(a_arg), _b(b_arg), _c(c_arg)
+ {
+ assert(_a <= _b && _b <= _c);
+ }
+
+ /** Returns the minimum value of the distribution. */
+ RealType a() const { return _a; }
+ /** Returns the mode of the distribution. */
+ RealType b() const { return _b; }
+ /** Returns the maximum value of the distribution. */
+ RealType c() const { return _c; }
+
+ /** Writes the parameters to a @c std::ostream. */
+ BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR(os, param_type, parm)
+ {
+ os << parm._a << " " << parm._b << " " << parm._c;
+ return os;
+ }
+
+ /** Reads the parameters from a @c std::istream. */
+ BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR(is, param_type, parm)
+ {
+ double a_in, b_in, c_in;
+ if(is >> a_in >> std::ws >> b_in >> std::ws >> c_in) {
+ if(a_in <= b_in && b_in <= c_in) {
+ parm._a = a_in;
+ parm._b = b_in;
+ parm._c = c_in;
+ } else {
+ is.setstate(std::ios_base::failbit);
+ }
+ }
+ return is;
+ }
+
+ /** Returns true if the two sets of parameters are equal. */
+ BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR(param_type, lhs, rhs)
+ { return lhs._a == rhs._a && lhs._b == rhs._b && lhs._c == rhs._c; }
+
+ /** Returns true if the two sets of parameters are different. */
+ BOOST_RANDOM_DETAIL_INEQUALITY_OPERATOR(param_type)
+
+ private:
+ RealType _a;
+ RealType _b;
+ RealType _c;
+ };
+
+ /**
+ * Constructs a @c triangle_distribution with the parameters
+ * @c a, @c b, and @c c.
+ *
+ * Preconditions: a <= b <= c.
+ */
+ explicit triangle_distribution(RealType a_arg = RealType(0.0),
+ RealType b_arg = RealType(0.5),
+ RealType c_arg = RealType(1.0))
+ : _a(a_arg), _b(b_arg), _c(c_arg)
+ {
+ assert(_a <= _b && _b <= _c);
+ init();
+ }
+
+ /** Constructs a @c triangle_distribution from its parameters. */
+ explicit triangle_distribution(const param_type& parm)
+ : _a(parm.a()), _b(parm.b()), _c(parm.c())
+ {
+ init();
+ }
+
+ // compiler-generated copy ctor and assignment operator are fine
+
+ /** Returns the @c a parameter of the distribution */
+ result_type a() const { return _a; }
+ /** Returns the @c b parameter of the distribution */
+ result_type b() const { return _b; }
+ /** Returns the @c c parameter of the distribution */
+ result_type c() const { return _c; }
+
+ /** Returns the smallest value that the distribution can produce. */
+ RealType min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _a; }
+ /** Returns the largest value that the distribution can produce. */
+ RealType max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _c; }
+
+ /** Returns the parameters of the distribution. */
+ param_type param() const { return param_type(_a, _b, _c); }
+ /** Sets the parameters of the distribution. */
+ void param(const param_type& parm)
+ {
+ _a = parm.a();
+ _b = parm.b();
+ _c = parm.c();
+ init();
+ }
+
+ /**
+ * Effects: Subsequent uses of the distribution do not depend
+ * on values produced by any engine prior to invoking reset.
+ */
+ void reset() { }
+
+ /**
+ * Returns a random variate distributed according to the
+ * triangle distribution.
+ */
+ template<class Engine>
+ result_type operator()(Engine& eng)
+ {
+ using std::sqrt;
+ result_type u = uniform_01<>()(eng);
+ if( u <= q1 )
+ return _a + p1*sqrt(u);
+ else
+ return _c - d3*sqrt(d2*u-d1);
+ }
+
+ /**
+ * Returns a random variate distributed according to the
+ * triangle distribution with parameters specified by param.
+ */
+ template<class Engine>
+ result_type operator()(Engine& eng, const param_type& parm)
+ { return triangle_distribution(parm)(eng); }
+
+ /** Writes the distribution to a @c std::ostream. */
+ BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR(os, triangle_distribution, td)
+ {
+ os << td.param();
+ return os;
+ }
+
+ /** Reads the distribution from a @c std::istream. */
+ BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR(is, triangle_distribution, td)
+ {
+ param_type parm;
+ if(is >> parm) {
+ td.param(parm);
+ }
+ return is;
+ }
+
+ /**
+ * Returns true if the two distributions will produce identical
+ * sequences of values given equal generators.
+ */
+ BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR(triangle_distribution, lhs, rhs)
+ { return lhs._a == rhs._a && lhs._b == rhs._b && lhs._c == rhs._c; }
+
+ /**
+ * Returns true if the two distributions may produce different
+ * sequences of values given equal generators.
+ */
+ BOOST_RANDOM_DETAIL_INEQUALITY_OPERATOR(triangle_distribution)
 
 private:
- /// \cond hide_private_members
- void init()
- {
-#ifndef BOOST_NO_STDC_NAMESPACE
- using std::sqrt;
-#endif
- d1 = _b - _a;
- d2 = _c - _a;
- d3 = sqrt(_c - _b);
- q1 = d1 / d2;
- p1 = sqrt(d1 * d2);
- }
- /// \endcond
+ /// \cond
+ void init()
+ {
+ using std::sqrt;
+ d1 = _b - _a;
+ d2 = _c - _a;
+ d3 = sqrt(_c - _b);
+ q1 = d1 / d2;
+ p1 = sqrt(d1 * d2);
+ }
+ /// \endcond
 
- result_type _a, _b, _c;
- result_type d1, d2, d3, q1, p1;
+ RealType _a, _b, _c;
+ RealType d1, d2, d3, q1, p1;
 };
 
+} // namespace random
+
+using random::triangle_distribution;
+
 } // namespace boost
 
 #endif // BOOST_RANDOM_TRIANGLE_DISTRIBUTION_HPP

Modified: trunk/libs/random/test/Jamfile.v2
==============================================================================
--- trunk/libs/random/test/Jamfile.v2 (original)
+++ trunk/libs/random/test/Jamfile.v2 2011-01-24 20:17:50 EST (Mon, 24 Jan 2011)
@@ -83,6 +83,8 @@
 run test_geometric_distribution.cpp /boost//unit_test_framework ;
 run test_lognormal.cpp ;
 run test_lognormal_distribution.cpp /boost//unit_test_framework ;
+run test_triangle.cpp ;
+run test_triangle_distribution.cpp /boost//unit_test_framework ;
 
 # run nondet_random_speed.cpp ;
 # run random_device.cpp ;

Modified: trunk/libs/random/test/test_distribution.ipp
==============================================================================
--- trunk/libs/random/test/test_distribution.ipp (original)
+++ trunk/libs/random/test/test_distribution.ipp 2011-01-24 20:17:50 EST (Mon, 24 Jan 2011)
@@ -25,15 +25,30 @@
 #ifdef BOOST_RANDOM_ARG2
     BOOST_CHECK_EQUAL(dist.BOOST_RANDOM_ARG2(), BOOST_RANDOM_ARG2_DEFAULT);
 #endif
+#ifdef BOOST_RANDOM_ARG3
+ BOOST_CHECK_EQUAL(dist.BOOST_RANDOM_ARG3(), BOOST_RANDOM_ARG3_DEFAULT);
+#endif
     BOOST_RANDOM_DISTRIBUTION dist_one(BOOST_RANDOM_ARG1_VALUE);
     BOOST_CHECK_EQUAL(dist_one.BOOST_RANDOM_ARG1(), BOOST_RANDOM_ARG1_VALUE);
 #ifdef BOOST_RANDOM_ARG2
     BOOST_CHECK_EQUAL(dist_one.BOOST_RANDOM_ARG2(), BOOST_RANDOM_ARG2_DEFAULT);
 #endif
+#ifdef BOOST_RANDOM_ARG3
+ BOOST_CHECK_EQUAL(dist_one.BOOST_RANDOM_ARG3(), BOOST_RANDOM_ARG3_DEFAULT);
+#endif
 #ifdef BOOST_RANDOM_ARG2
     BOOST_RANDOM_DISTRIBUTION dist_two(BOOST_RANDOM_ARG1_VALUE, BOOST_RANDOM_ARG2_VALUE);
     BOOST_CHECK_EQUAL(dist_two.BOOST_RANDOM_ARG1(), BOOST_RANDOM_ARG1_VALUE);
     BOOST_CHECK_EQUAL(dist_two.BOOST_RANDOM_ARG2(), BOOST_RANDOM_ARG2_VALUE);
+#ifdef BOOST_RANDOM_ARG3
+ BOOST_CHECK_EQUAL(dist_two.BOOST_RANDOM_ARG3(), BOOST_RANDOM_ARG3_DEFAULT);
+#endif
+#endif
+#ifdef BOOST_RANDOM_ARG3
+ BOOST_RANDOM_DISTRIBUTION dist_three(BOOST_RANDOM_ARG1_VALUE, BOOST_RANDOM_ARG2_VALUE, BOOST_RANDOM_ARG3_VALUE);
+ BOOST_CHECK_EQUAL(dist_three.BOOST_RANDOM_ARG1(), BOOST_RANDOM_ARG1_VALUE);
+ BOOST_CHECK_EQUAL(dist_three.BOOST_RANDOM_ARG2(), BOOST_RANDOM_ARG2_VALUE);
+ BOOST_CHECK_EQUAL(dist_three.BOOST_RANDOM_ARG3(), BOOST_RANDOM_ARG3_VALUE);
 #endif
     BOOST_RANDOM_DISTRIBUTION copy(dist);
     BOOST_CHECK_EQUAL(dist, copy);
@@ -43,10 +58,16 @@
     BOOST_RANDOM_DISTRIBUTION copy_two(dist_two);
     BOOST_CHECK_EQUAL(dist_two, copy_two);
 #endif
+#ifdef BOOST_RANDOM_ARG3
+ BOOST_RANDOM_DISTRIBUTION copy_three(dist_three);
+ BOOST_CHECK_EQUAL(dist_three, copy_three);
+#endif
 }
 
 BOOST_AUTO_TEST_CASE(test_param) {
-#ifdef BOOST_RANDOM_ARG2
+#if defined(BOOST_RANDOM_ARG3)
+ BOOST_RANDOM_DISTRIBUTION dist(BOOST_RANDOM_ARG1_VALUE, BOOST_RANDOM_ARG2_VALUE, BOOST_RANDOM_ARG3_VALUE);
+#elif defined(BOOST_RANDOM_ARG2)
     BOOST_RANDOM_DISTRIBUTION dist(BOOST_RANDOM_ARG1_VALUE, BOOST_RANDOM_ARG2_VALUE);
 #else
     BOOST_RANDOM_DISTRIBUTION dist(BOOST_RANDOM_ARG1_VALUE);
@@ -56,6 +77,9 @@
 #ifdef BOOST_RANDOM_ARG2
     BOOST_CHECK_EQUAL(param.BOOST_RANDOM_ARG2(), BOOST_RANDOM_ARG2_VALUE);
 #endif
+#ifdef BOOST_RANDOM_ARG3
+ BOOST_CHECK_EQUAL(param.BOOST_RANDOM_ARG3(), BOOST_RANDOM_ARG3_VALUE);
+#endif
     BOOST_RANDOM_DISTRIBUTION copy1(param);
     BOOST_CHECK_EQUAL(dist, copy1);
     BOOST_RANDOM_DISTRIBUTION copy2;
@@ -71,6 +95,9 @@
 #ifdef BOOST_RANDOM_ARG2
     BOOST_CHECK_EQUAL(param_default.BOOST_RANDOM_ARG2(), BOOST_RANDOM_ARG2_DEFAULT);
 #endif
+#ifdef BOOST_RANDOM_ARG3
+ BOOST_CHECK_EQUAL(param_default.BOOST_RANDOM_ARG3(), BOOST_RANDOM_ARG3_DEFAULT);
+#endif
     BOOST_CHECK(param != param_default);
     BOOST_CHECK(!(param == param_default));
     BOOST_RANDOM_DISTRIBUTION::param_type param_one(BOOST_RANDOM_ARG1_VALUE);
@@ -78,6 +105,9 @@
 #ifdef BOOST_RANDOM_ARG2
     BOOST_CHECK_EQUAL(param_one.BOOST_RANDOM_ARG2(), BOOST_RANDOM_ARG2_DEFAULT);
 #endif
+#ifdef BOOST_RANDOM_ARG3
+ BOOST_CHECK_EQUAL(param_one.BOOST_RANDOM_ARG3(), BOOST_RANDOM_ARG3_DEFAULT);
+#endif
 #ifdef BOOST_RANDOM_ARG2
     BOOST_CHECK(param != param_one);
     BOOST_CHECK(!(param == param_one));
@@ -88,6 +118,15 @@
     BOOST_RANDOM_DISTRIBUTION::param_type param_two(BOOST_RANDOM_ARG1_VALUE, BOOST_RANDOM_ARG2_VALUE);
     BOOST_CHECK_EQUAL(param_two.BOOST_RANDOM_ARG1(), BOOST_RANDOM_ARG1_VALUE);
     BOOST_CHECK_EQUAL(param_two.BOOST_RANDOM_ARG2(), BOOST_RANDOM_ARG2_VALUE);
+#ifdef BOOST_RANDOM_ARG3
+ BOOST_CHECK_EQUAL(param_two.BOOST_RANDOM_ARG3(), BOOST_RANDOM_ARG3_DEFAULT);
+#endif
+#endif
+#ifdef BOOST_RANDOM_ARG3
+ BOOST_RANDOM_DISTRIBUTION::param_type param_three(BOOST_RANDOM_ARG1_VALUE, BOOST_RANDOM_ARG2_VALUE, BOOST_RANDOM_ARG3_VALUE);
+ BOOST_CHECK_EQUAL(param_three.BOOST_RANDOM_ARG1(), BOOST_RANDOM_ARG1_VALUE);
+ BOOST_CHECK_EQUAL(param_three.BOOST_RANDOM_ARG2(), BOOST_RANDOM_ARG2_VALUE);
+ BOOST_CHECK_EQUAL(param_three.BOOST_RANDOM_ARG3(), BOOST_RANDOM_ARG3_VALUE);
 #endif
 }
 
@@ -103,6 +142,11 @@
     BOOST_CHECK_EQUAL((dist_two.min)(), BOOST_RANDOM_DIST2_MIN);
     BOOST_CHECK_EQUAL((dist_two.max)(), BOOST_RANDOM_DIST2_MAX);
 #endif
+#ifdef BOOST_RANDOM_ARG3
+ BOOST_RANDOM_DISTRIBUTION dist_three(BOOST_RANDOM_ARG1_VALUE, BOOST_RANDOM_ARG2_VALUE, BOOST_RANDOM_ARG3_VALUE);
+ BOOST_CHECK_EQUAL((dist_three.min)(), BOOST_RANDOM_DIST3_MIN);
+ BOOST_CHECK_EQUAL((dist_three.max)(), BOOST_RANDOM_DIST3_MAX);
+#endif
 }
 
 BOOST_AUTO_TEST_CASE(test_comparison) {
@@ -114,6 +158,10 @@
     BOOST_RANDOM_DISTRIBUTION dist_two(BOOST_RANDOM_ARG1_VALUE, BOOST_RANDOM_ARG2_VALUE);
     BOOST_RANDOM_DISTRIBUTION dist_two_copy(dist_two);
 #endif
+#ifdef BOOST_RANDOM_ARG3
+ BOOST_RANDOM_DISTRIBUTION dist_three(BOOST_RANDOM_ARG1_VALUE, BOOST_RANDOM_ARG2_VALUE, BOOST_RANDOM_ARG3_VALUE);
+ BOOST_RANDOM_DISTRIBUTION dist_three_copy(dist_three);
+#endif
     BOOST_CHECK(dist == dist_copy);
     BOOST_CHECK(!(dist != dist_copy));
     BOOST_CHECK(dist_one == dist_one_copy);
@@ -128,10 +176,22 @@
     BOOST_CHECK(dist_one != dist_two);
     BOOST_CHECK(!(dist_one == dist_two));
 #endif
+#ifdef BOOST_RANDOM_ARG3
+ BOOST_CHECK(dist_three == dist_three_copy);
+ BOOST_CHECK(!(dist_three != dist_three_copy));
+ BOOST_CHECK(dist != dist_three);
+ BOOST_CHECK(!(dist == dist_three));
+ BOOST_CHECK(dist_one != dist_three);
+ BOOST_CHECK(!(dist_one == dist_three));
+ BOOST_CHECK(dist_two != dist_three);
+ BOOST_CHECK(!(dist_two == dist_three));
+#endif
 }
 
 BOOST_AUTO_TEST_CASE(test_streaming) {
-#ifdef BOOST_RANDOM_ARG2
+#if defined(BOOST_RANDOM_ARG3)
+ BOOST_RANDOM_DISTRIBUTION dist(BOOST_RANDOM_ARG1_VALUE, BOOST_RANDOM_ARG2_VALUE, BOOST_RANDOM_ARG2_VALUE);
+#elif defined(BOOST_RANDOM_ARG2)
     BOOST_RANDOM_DISTRIBUTION dist(BOOST_RANDOM_ARG1_VALUE, BOOST_RANDOM_ARG2_VALUE);
 #else
     BOOST_RANDOM_DISTRIBUTION dist(BOOST_RANDOM_ARG1_VALUE);

Modified: trunk/libs/random/test/test_real_distribution.ipp
==============================================================================
--- trunk/libs/random/test/test_real_distribution.ipp (original)
+++ trunk/libs/random/test/test_real_distribution.ipp 2011-01-24 20:17:50 EST (Mon, 24 Jan 2011)
@@ -17,6 +17,14 @@
 #endif
 #endif
 
+#ifndef BOOST_RANDOM_DISTRIBUTION_INIT
+#ifdef BOOST_RANDOM_ARG2_TYPE
+#define BOOST_RANDOM_DISTRIBUTION_INIT (BOOST_RANDOM_ARG1_NAME, BOOST_RANDOM_ARG2_NAME)
+#else
+#define BOOST_RANDOM_DISTRIBUTION_INIT (BOOST_RANDOM_ARG1_NAME)
+#endif
+#endif
+
 #include <boost/random/mersenne_twister.hpp>
 #include <boost/lexical_cast.hpp>
 #include <boost/exception/diagnostic_information.hpp>
@@ -42,11 +50,7 @@
 
     BOOST_MATH_DISTRIBUTION expected BOOST_MATH_DISTRIBUTION_INIT;
     
- BOOST_RANDOM_DISTRIBUTION dist(BOOST_RANDOM_ARG1_NAME
-#ifdef BOOST_RANDOM_ARG2_NAME
- , BOOST_RANDOM_ARG2_NAME
-#endif
- );
+ BOOST_RANDOM_DISTRIBUTION dist BOOST_RANDOM_DISTRIBUTION_INIT;
     boost::mt19937 gen;
 
 #ifdef BOOST_RANDOM_DISTRIBUTION_MAX

Added: trunk/libs/random/test/test_triangle.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/random/test/test_triangle.cpp 2011-01-24 20:17:50 EST (Mon, 24 Jan 2011)
@@ -0,0 +1,26 @@
+/* test_triangle.cpp
+ *
+ * Copyright Steven Watanabe 2011
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * $Id$
+ *
+ */
+
+#include <boost/random/triangle_distribution.hpp>
+#include <boost/random/uniform_real.hpp>
+#include <boost/math/distributions/triangular.hpp>
+
+#define BOOST_RANDOM_DISTRIBUTION boost::random::triangle_distribution<>
+#define BOOST_RANDOM_DISTRIBUTION_NAME lognormal
+#define BOOST_MATH_DISTRIBUTION boost::math::triangular
+#define BOOST_RANDOM_ARG1_TYPE double
+#define BOOST_RANDOM_ARG1_NAME b
+#define BOOST_RANDOM_ARG1_DEFAULT 0.5
+#define BOOST_RANDOM_ARG1_DISTRIBUTION(n) boost::uniform_real<>(0.0001, 0.9999)
+#define BOOST_RANDOM_DISTRIBUTION_INIT (0.0, b, 1.0)
+#define BOOST_MATH_DISTRIBUTION_INIT (0.0, b, 1.0)
+
+#include "test_real_distribution.ipp"

Added: trunk/libs/random/test/test_triangle_distribution.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/random/test/test_triangle_distribution.cpp 2011-01-24 20:17:50 EST (Mon, 24 Jan 2011)
@@ -0,0 +1,41 @@
+/* test_triangle_distribution.cpp
+ *
+ * Copyright Steven Watanabe 2011
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * $Id$
+ *
+ */
+
+#include <boost/random/triangle_distribution.hpp>
+#include <limits>
+
+#define BOOST_RANDOM_DISTRIBUTION boost::random::triangle_distribution<>
+#define BOOST_RANDOM_ARG1 a
+#define BOOST_RANDOM_ARG2 b
+#define BOOST_RANDOM_ARG3 c
+#define BOOST_RANDOM_ARG1_DEFAULT 0.0
+#define BOOST_RANDOM_ARG2_DEFAULT 0.5
+#define BOOST_RANDOM_ARG3_DEFAULT 1.0
+#define BOOST_RANDOM_ARG1_VALUE -0.5
+#define BOOST_RANDOM_ARG2_VALUE 0.25
+#define BOOST_RANDOM_ARG3_VALUE 1.5
+
+#define BOOST_RANDOM_DIST0_MIN 0.0
+#define BOOST_RANDOM_DIST0_MAX 1.0
+#define BOOST_RANDOM_DIST1_MIN -0.5
+#define BOOST_RANDOM_DIST1_MAX 1.0
+#define BOOST_RANDOM_DIST2_MIN -0.5
+#define BOOST_RANDOM_DIST2_MAX 1.0
+#define BOOST_RANDOM_DIST3_MIN -0.5
+#define BOOST_RANDOM_DIST3_MAX 1.5
+
+#define BOOST_RANDOM_TEST1_PARAMS (-1, -0.5, 0)
+#define BOOST_RANDOM_TEST1_MAX 0
+
+#define BOOST_RANDOM_TEST2_PARAMS (0, 0.5, 1)
+#define BOOST_RANDOM_TEST2_MIN 0
+
+#include "test_distribution.ipp"


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