Commit Graph

387 Commits

Author SHA1 Message Date
Steven Watanabe
30a2b59c7b Make sure that discard is always provided by using uintmax_t instead of ulong_long_type.
[SVN r69976]
2011-03-14 20:09:37 +00:00
Steven Watanabe
0265c4371d Remove pass_through_engine. Make uniform_int_float more correct.
[SVN r69975]
2011-03-14 19:42:32 +00:00
Steven Watanabe
2690f16a2c Some optimizations for ranlux.
[SVN r69969]
2011-03-14 02:46:15 +00:00
Steven Watanabe
cfb5ec9825 Add missing file.
[SVN r69961]
2011-03-13 18:28:07 +00:00
Steven Watanabe
d096eb569f Make seeding more consistent and add some tests to lock down the algorithms.
[SVN r69912]
2011-03-13 04:49:34 +00:00
Steven Watanabe
ed945c9eb1 A separate WeightType doesn't make sense for piecewise_linear_distribution.
[SVN r68968]
2011-02-17 16:28:12 +00:00
Steven Watanabe
b0b7fb471a Apparently, neither gcc 4.5, nor msvc 10 can optimize away this loop.
[SVN r68874]
2011-02-14 22:44:10 +00:00
Steven Watanabe
3738b7e4ff Update performance numbers.
[SVN r68872]
2011-02-14 21:31:10 +00:00
Steven Watanabe
e4fbc88c54 Optimize linear_congruential_engine::discard.
[SVN r68851]
2011-02-13 20:21:15 +00:00
Steven Watanabe
e4cca265d0 Use unsigned types everywhere to be compatible with the standard, which is more restrictive in this respect.
[SVN r68823]
2011-02-13 04:05:26 +00:00
Steven Watanabe
8c30753bf4 Sync the docs with the current library.
[SVN r68822]
2011-02-13 03:28:59 +00:00
Steven Watanabe
21d66a0a2c Fix problems reported by inspect.
[SVN r68817]
2011-02-12 20:03:17 +00:00
Steven Watanabe
d3e19bbc4f #include everything in boost/random.hpp
[SVN r68815]
2011-02-12 19:07:36 +00:00
Steven Watanabe
6858fa9514 Update random_device.
[SVN r68814]
2011-02-12 18:41:28 +00:00
Steven Watanabe
6962916b79 Implement generate_canonical.
[SVN r68813]
2011-02-12 18:06:40 +00:00
Steven Watanabe
fabd860d65 Maybe fix sun?
[SVN r68806]
2011-02-12 15:31:42 +00:00
Steven Watanabe
b5b8a2d4df Implement independent_bits_engine.
[SVN r68804]
2011-02-12 15:28:53 +00:00
Steven Watanabe
a9f049de2a Codegear fixes.
[SVN r68789]
2011-02-11 22:07:04 +00:00
Steven Watanabe
46a47b2a9d Help pgi?
[SVN r68788]
2011-02-11 21:32:07 +00:00
Steven Watanabe
edf89f7503 Move all generator tests to the new framework.
[SVN r68783]
2011-02-11 19:16:29 +00:00
Steven Watanabe
b653381ac4 Fix constructor.
[SVN r68769]
2011-02-11 02:11:57 +00:00
Steven Watanabe
67843975c0 Update xor_combine to match C++0x. min/max are still broken.
[SVN r68767]
2011-02-11 01:16:34 +00:00
Steven Watanabe
c646f4babb Update linear_feedback_shift_engine to match C++0x.
[SVN r68759]
2011-02-10 03:30:27 +00:00
Steven Watanabe
b5be1f6d9e Factor out some common seeding code.
[SVN r68758]
2011-02-10 01:27:11 +00:00
Steven Watanabe
0908708463 Update lagged_fibonacci to match C++0x.
[SVN r68754]
2011-02-09 22:34:46 +00:00
Steven Watanabe
c78729ebf5 Update inversive_congruential.
[SVN r68748]
2011-02-09 19:19:25 +00:00
Steven Watanabe
3cfc38c4f7 Fix const_mod to work in all cases.
[SVN r68747]
2011-02-09 16:49:49 +00:00
Steven Watanabe
a22d42305a Fix #include guard. Fixes #5171.
[SVN r68743]
2011-02-09 02:07:54 +00:00
Steven Watanabe
de24e82891 Update additive_combine.
[SVN r68727]
2011-02-08 17:46:48 +00:00
Steven Watanabe
5db9c081df Simplify variate_generator.
[SVN r68658]
2011-02-05 17:44:40 +00:00
Steven Watanabe
411eeb9c26 Update uniform_int and uniform_real.
[SVN r68647]
2011-02-05 05:54:11 +00:00
Steven Watanabe
b2bfbc0b75 Update uniform_smallint.
[SVN r68644]
2011-02-05 01:15:56 +00:00
Steven Watanabe
70ee378773 Update uniform_on_sphere.
[SVN r68631]
2011-02-03 21:16:56 +00:00
Steven Watanabe
23761be280 Add uniform_real_distribution to match C++0x.
[SVN r68444]
2011-01-25 20:08:07 +00:00
Steven Watanabe
a9a48b3330 Add uniform_int_distribution to match C++0x.
[SVN r68440]
2011-01-25 19:16:54 +00:00
Steven Watanabe
f051b0730e Update triangle_distribution to match C++0x.
[SVN r68428]
2011-01-25 01:17:50 +00:00
Steven Watanabe
1744f7c612 Update lognormal_distribution to match C++0x.
[SVN r68424]
2011-01-24 21:18:40 +00:00
Steven Watanabe
664bef0373 Update geometric_distribution to match C++0x.
[SVN r68410]
2011-01-24 06:28:59 +00:00
Steven Watanabe
0109f6e645 Update cauchy_distribution to match C++0x.
[SVN r68406]
2011-01-23 23:33:41 +00:00
Steven Watanabe
8b1fda2098 Update bernoulli_distribution to match C++0x.
[SVN r68375]
2011-01-23 02:14:26 +00:00
Steven Watanabe
28d9e4da2b Update exponential_distribution to C++0x.
[SVN r68372]
2011-01-22 21:44:25 +00:00
Steven Watanabe
ebc4157205 Tighten up test_piecewise_linear.
[SVN r68315]
2011-01-20 05:46:49 +00:00
Steven Watanabe
30ee3e6cee Tighten test_piecewise_constant.
[SVN r68311]
2011-01-20 02:18:08 +00:00
Steven Watanabe
f6951cd830 Concept test for distributions.
[SVN r68070]
2011-01-12 19:53:31 +00:00
Steven Watanabe
7623f1b6ef Implement piecewise_linear_distribution.
[SVN r68028]
2011-01-12 04:53:08 +00:00
Steven Watanabe
cee01dfcfa Fix piecewise_constant_distribution::param_type constructor with 1 interval boundary.
[SVN r67903]
2011-01-10 04:01:46 +00:00
Steven Watanabe
97fe018ee2 Fix piecewise_constant_distribution for C++0x.
[SVN r67878]
2011-01-09 20:11:07 +00:00
Steven Watanabe
8cda7a96af Implement piecewise_constant_distribution.
[SVN r67740]
2011-01-06 23:51:46 +00:00
Steven Watanabe
836da38bf7 Update normal_distribution to match C++0x. Implement student_t_distribution.
[SVN r67710]
2011-01-06 02:53:00 +00:00
Steven Watanabe
dced4df44a Implement fisher_f_distribution.
[SVN r67694]
2011-01-05 22:42:36 +00:00
Steven Watanabe
1845d03376 Implement chi_squared_distribution.
[SVN r67669]
2011-01-05 05:17:37 +00:00
Steven Watanabe
cbc4f223c2 Make result_type public. Fixes #4777.
[SVN r66803]
2010-11-27 21:28:21 +00:00
Steven Watanabe
9f9c1a5a98 #include the right header. Fixes #4653.
[SVN r65438]
2010-09-16 16:07:31 +00:00
Steven Watanabe
7c3fcb24dc Implement negative_binomial_distribution.
[SVN r65157]
2010-08-31 20:07:59 +00:00
Steven Watanabe
ac88d68a10 Refactor tests
[SVN r65093]
2010-08-29 04:03:02 +00:00
Steven Watanabe
7fd055a780 Add missing #include
[SVN r65092]
2010-08-29 03:47:16 +00:00
Steven Watanabe
02a9498948 Add the old names of the generators for backward compatibility.
[SVN r63549]
2010-07-03 17:52:16 +00:00
Steven Watanabe
c41aabe99a Some doc cleanup.
[SVN r63370]
2010-06-26 20:42:30 +00:00
Steven Watanabe
cf886a330f Fix a few typos and copy/paste errors.
[SVN r63331]
2010-06-26 00:15:56 +00:00
Steven Watanabe
4855688a63 Add extreme_value_distribution.
[SVN r63330]
2010-06-25 23:53:34 +00:00
Steven Watanabe
aab4ff005f Add weibull_distribution.
[SVN r63328]
2010-06-25 22:22:53 +00:00
Steven Watanabe
f702db6d89 Sync shuffle_order_engine with C++0x.
[SVN r63327]
2010-06-25 21:23:20 +00:00
Steven Watanabe
581361f3df Extend operator workarounds to Sun CC.
[SVN r63310]
2010-06-25 16:35:06 +00:00
Steven Watanabe
1daedf4f9c Attempt to fix Sun CC's problems with rand48.
[SVN r63292]
2010-06-24 18:03:17 +00:00
Steven Watanabe
526d371c03 Attempt to fix msvc-7.1 errors in subtract_with_carry.
[SVN r63286]
2010-06-24 15:58:41 +00:00
Steven Watanabe
11b2a55baa Fix shadowing of template parameters in linear_congruential_engine. Fixes #4371.
[SVN r63284]
2010-06-24 14:34:42 +00:00
Steven Watanabe
b3915ef6b1 Sync ranlux with C++0x.
[SVN r63279]
2010-06-24 03:57:42 +00:00
Steven Watanabe
cae34bd24a Sync discard_block with C++0x.
[SVN r63278]
2010-06-24 03:05:45 +00:00
Steven Watanabe
b32280f5fa A few more fixes for msvc-7.1
[SVN r63276]
2010-06-24 00:44:28 +00:00
Steven Watanabe
89530779e6 Sync subtract_with_carry with C++0x.
[SVN r63274]
2010-06-24 00:25:52 +00:00
Steven Watanabe
a06b888c94 Sync linear_congruential with C++0x.
[SVN r63270]
2010-06-23 20:55:43 +00:00
Steven Watanabe
978a83d8d1 Add missing using for Sun.
[SVN r63261]
2010-06-23 18:47:56 +00:00
Steven Watanabe
c5cdd46089 Some optimizations to mersenne_twister.
[SVN r63260]
2010-06-23 18:15:27 +00:00
Steven Watanabe
e580086e65 Sync gamma_distribution with C++0x. Fixes #3888.
[SVN r63247]
2010-06-22 20:22:41 +00:00
Steven Watanabe
e9b6830669 Fix vc71 errors, take 2.
[SVN r63240]
2010-06-22 15:29:59 +00:00
Steven Watanabe
3303ce69bc Sync mersenne_twister with C++0x.
[SVN r63217]
2010-06-22 02:30:09 +00:00
Steven Watanabe
a46d157029 Attempt to fix Sun and msvc-7.1 errors.
[SVN r63188]
2010-06-21 15:13:11 +00:00
Steven Watanabe
2c7387f6ae Implement discrete_distribution. Fixes #920.
[SVN r63180]
2010-06-21 04:03:55 +00:00
Steven Watanabe
e8a792c155 Fix another integer overflow problem.
[SVN r63155]
2010-06-20 19:06:56 +00:00
Steven Watanabe
773e647806 Better implementation of the poisson distribution. Fixes #1540.
[SVN r63126]
2010-06-20 03:24:28 +00:00
Steven Watanabe
94d50aa090 Fix integer overflow bug.
[SVN r63101]
2010-06-19 14:55:52 +00:00
Steven Watanabe
0bfc67b8fd Fix my floor silliness. e.g. int(-0.5) != floor(-0.5)
[SVN r63092]
2010-06-19 04:31:28 +00:00
Steven Watanabe
e7e3a4a676 Reimplement binomial_distribution.
[SVN r63088]
2010-06-18 22:05:11 +00:00
Steven Watanabe
463e1d4e0f Check for range errors in the input operator of linear_congruential. Fixes #2667
[SVN r62548]
2010-06-08 04:03:58 +00:00
Steven Watanabe
c11219f596 Make sure that all members are initialized. Fixes #4085
[SVN r62545]
2010-06-08 03:21:28 +00:00
Steven Watanabe
e5359a15b0 Try to help out borland
[SVN r60619]
2010-03-15 17:18:52 +00:00
Steven Watanabe
e318ab4bf2 Attempt to fix Sun CC 5.10 failures
[SVN r60615]
2010-03-15 16:46:53 +00:00
Steven Watanabe
eba3181c16 Fix remaining broken links
[SVN r60391]
2010-03-09 23:15:18 +00:00
Steven Watanabe
2356b3bef8 Fix a minor typo
[SVN r60353]
2010-03-08 16:03:20 +00:00
Steven Watanabe
2e4c0f628c Make statistics_tests usable with the current library
[SVN r60279]
2010-03-07 05:22:40 +00:00
Steven Watanabe
bef66181dd Fix dll linking
[SVN r60210]
2010-03-05 19:56:52 +00:00
Steven Watanabe
bc73588c7e Rearrange the componenents in libs/random and create a library for random_device. Fixes #3672
[SVN r60199]
2010-03-05 19:12:45 +00:00
Steven Watanabe
2248892f09 Add Quickbook/Doxygen documentation
[SVN r59910]
2010-02-25 18:13:36 +00:00
Marshall Clow
f3aa639a1f Fixed shadow warnings reported in ticket 3710
[SVN r58148]
2009-12-04 22:22:01 +00:00
Steven Watanabe
330c6db3cb Fix min/max problems
[SVN r57717]
2009-11-16 23:38:21 +00:00
Steven Watanabe
6e35d9a732 Allow arbitrary values to be used as seeds for linear_congruential, linear_feedback_shift, and any generators that depend on them. Fixes #3516
[SVN r57663]
2009-11-14 21:07:31 +00:00
Steven Watanabe
af6a0d558a Disable some warnings for msvc. Fixes #3532
[SVN r57008]
2009-10-19 22:53:04 +00:00
Steven Watanabe
7dda7d38bb Supress warnings from narrowing conversions.
[SVN r53888]
2009-06-14 02:33:22 +00:00
Steven Watanabe
ac8bfba53a misc assertions/tests
[SVN r53802]
2009-06-12 00:24:09 +00:00
Steven Watanabe
05846ff977 Fix overload resolution for generator constructors/seed. Fixes #351. Fixes #2424. Fixes #2887
[SVN r53699]
2009-06-06 19:41:38 +00:00
Steven Watanabe
b9a410339d Fix the distribution of uniform_int.
[SVN r53462]
2009-05-30 16:38:53 +00:00
Jeremiah Willcock
d2f73925af Fixed most tab and min/max issues from trunk inspection report
[SVN r53141]
2009-05-20 19:19:00 +00:00
Steven Watanabe
dfabc22362 Add missing includes.
[SVN r52425]
2009-04-16 18:16:50 +00:00
Steven Watanabe
a2ba8e2ac8 Enable stream operators on msvc. Fixes #1068. Fixes #1691
[SVN r51413]
2009-02-23 15:48:27 +00:00
Steven Watanabe
5f1713f436 Initialize _modulus in the linear_congruential constructor that takes a pair of iterators. Fixes #2665
[SVN r51410]
2009-02-23 01:19:37 +00:00
Steven Watanabe
86aad2f7f7 Convert uniform_01 to the current distribution interface, dispatching on the first template paramter to retain backwards compatibility. Fixes #599. Fixes #1544. Fixes #2679
[SVN r51337]
2009-02-19 23:27:40 +00:00
Steven Watanabe
b9f17bed6b Change shfit2 to shift2. Add missing namespace scope definitions of shift1 and shift2. Fixes #2764
[SVN r51311]
2009-02-18 17:54:27 +00:00
Steven Watanabe
c1c5c98651 correctly detect the end of the range in lagged_fibonacci_01::seed. Fixes #2703
[SVN r51120]
2009-02-08 23:50:56 +00:00
Steven Watanabe
917c2d45b1 Make validation a static member function. Fixes #2673
[SVN r50997]
2009-02-03 19:18:59 +00:00
Marshall Clow
9ef9354097 Applied patch from bug #1546
[SVN r50312]
2008-12-18 02:37:07 +00:00
John Maddock
f667a1e945 Change includes of <cmath> to <boost/config/no_tr1/config.hpp>.
Previously if Boost.TR1 was in the include path then including <cmath> pulls in all the new TR1 math functions, which in turn also requires linking to an external library.  With auto-linking support this requires that library to have been built and be present in the library search path, even if the actual library under use is header only.

Fixes #2392.


[SVN r49254]
2008-10-10 16:10:00 +00:00
Steven Watanabe
1d7cbef7e2 Replace random's make_unsigned with the type_traits version. Fixes #2026
[SVN r46580]
2008-06-21 16:07:44 +00:00
Marshall Clow
9512b57937 Updated bounds on uniform_real and uniform_smallint to allow min == max
[SVN r44897]
2008-04-29 20:16:19 +00:00
Marshall Clow
e1fcb34b32 Patches to fixe #1423 and #1473
[SVN r42141]
2007-12-18 18:33:55 +00:00
Jens Maurer
c41b4d5bf5 we're actually using the Box-Muller method (with trigonometric functions)
[SVN r37704]
2007-05-17 08:37:54 +00:00
Jens Maurer
7fa86c3bdd local variables should not shadow class members
[SVN r37032]
2007-02-21 20:29:57 +00:00
Jens Maurer
28303eb08a sf.net bug #1665485: local variables should not shadow class members
[SVN r37031]
2007-02-21 20:16:35 +00:00
Jens Maurer
b030f6c24d sf.net bug #1665444: local variables should not shadow class members
[SVN r37030]
2007-02-21 20:11:48 +00:00
Jens Maurer
b6d3961d00 rounding errors must not cause values outside of [0,1) (noted by Charles Karney)
[SVN r34877]
2006-08-11 23:17:07 +00:00
Jens Maurer
465a483356 address uniform_int<> signed/unsigned/overflow issues (noted by Charles Karney)
[SVN r34876]
2006-08-11 23:12:39 +00:00
Jens Maurer
8a47c06e6a fix const-correctness bug (noticed by Roman Yakovenko)
[SVN r34875]
2006-08-11 21:36:11 +00:00
Jens Maurer
6458746820 fix sourceforge bug #1524016: bad seed() implementation
[SVN r34600]
2006-07-19 21:51:23 +00:00
Matthias Troyer
598397852f Fixed missing include according to bug # 1504417
[SVN r34430]
2006-06-30 06:38:11 +00:00
Jens Maurer
9b493b296a fix bug 1505014: avoid signed overflow in modular addition
[SVN r34428]
2006-06-29 23:17:14 +00:00
John Maddock
9629ae44a5 Large patch from Ulrich Eckhardt to fix support for EVC++ 4.
[SVN r30670]
2005-08-25 16:27:28 +00:00
Jens Maurer
0b7d6db9e2 generalize initialization change to other than 32 bits
[SVN r30208]
2005-07-21 22:04:31 +00:00
Jens Maurer
381439b97d fix bug #1220358: probability p was not forwarded to contained bernoulli
[SVN r29791]
2005-06-24 22:13:43 +00:00
Douglas Gregor
9eacbed88b Revert Jens Maurer's changes until after release
[SVN r29116]
2005-05-21 15:57:01 +00:00
Jens Maurer
409ac3557a implement ctor and seeding for "unsigned long" and template<class Generator>,
use enable_if<> to guide overload resolution


[SVN r29077]
2005-05-19 21:29:06 +00:00
Jens Maurer
24b28494a9 prepare for negative binomial implementation
[SVN r29076]
2005-05-19 21:26:05 +00:00
Jens Maurer
280514ff28 use enable_if<> to guide overload resolution for template<class Generator> ctor
[SVN r29075]
2005-05-19 21:23:29 +00:00
Jens Maurer
b3b5001821 implement ctor and seeding for "unsigned long" and template<class Generator>,
use enable_if<> to guide overload resolution


[SVN r29074]
2005-05-19 21:21:32 +00:00
Douglas Gregor
f47d8a0bd9 Work around bug in Apple's GCC 3.3
[SVN r28903]
2005-05-14 18:36:13 +00:00
Douglas Gregor
247de90d65 Work around compilation bug in Apple's GCC 3.3
[SVN r28902]
2005-05-14 17:17:49 +00:00
Jens Maurer
a3e3daf579 add #include <cmath> for std::pow
[SVN r28793]
2005-05-10 20:30:46 +00:00
Jens Maurer
b450fc98f2 fix conceptual maths bug in seeding for mersenne_twister<>
[SVN r28270]
2005-04-15 09:28:57 +00:00
John Maddock
774dcb5188 Make engine_value_type public as per the TR.
[SVN r27375]
2005-02-14 11:53:50 +00:00
Douglas Gregor
6db20959fc Deal with macroized min/max
[SVN r26899]
2005-01-28 15:04:17 +00:00
Douglas Gregor
65362c1c47 Cast in the right places
[SVN r26674]
2005-01-11 15:34:18 +00:00
Jens Maurer
73e6db0840 as per the TR, input floating-point Engine's are not required to return
values in the range [0..1[ (Douglas Gregor)


[SVN r26612]
2004-12-31 15:55:27 +00:00
Jens Maurer
2b360fb849 fix sourceforge bug 911758: properly instantiate variate_generator<> using a
reference to the base engine


[SVN r26164]
2004-11-09 21:22:00 +00:00
Jens Maurer
94de4132a2 include <cmath> for std::pow
[SVN r26163]
2004-11-09 21:04:35 +00:00
Michael Stevens
7de99be8ad Use std::min/max instead of BOOST_USING_STD_MIN/MAX
for gcc-2.95. Ok for other conforming compilers.


[SVN r25490]
2004-09-30 19:15:32 +00:00
Vladimir Prus
27ecfe77d4 Add missing includes. Without them g++ 3.4 can't compile the following
program:

    #include <boost/random.hpp>
    using namespace boost;
    boost::mt19937 rng;
    uniform_int<> gen(0, 10);

    void do_it()
    {
        gen(rng);
    }


[SVN r25475]
2004-09-29 13:25:37 +00:00
Michael Stevens
3e53b922c7 Work around GCC 3.3 problem with
max() { (std::numeric_limit<xx>::max) (); }
Causing and infinite recursion


[SVN r24496]
2004-08-16 09:09:35 +00:00
Jens Maurer
0d597a6afc fix compiler warning on MSVC 7.1 (Stefan Slapeta)
[SVN r24194]
2004-07-30 21:08:06 +00:00
Douglas Gregor
c5d8766e66 Converted to Boost Software License, Version 1.0
[SVN r24096]
2004-07-27 03:43:34 +00:00
Eric Niebler
9febe9be3f move BOOST_USING_STD_MIN and _MAX and BOOST_PREVENT_MACRO_SUBSTITUTION to the config headers, remove boost/minmax.hpp, update coding guidelines
[SVN r23313]
2004-07-02 01:21:32 +00:00
Eric Niebler
2f7b6e8f3d remove std_min and std_max, update minmax coding guidelines
[SVN r23162]
2004-06-23 04:49:48 +00:00
Jens Maurer
3ab77175bc add seed() member functions as per latest WG21 paper (Mario Ruetti)
[SVN r22911]
2004-05-24 20:56:58 +00:00