OSDN Git Service

2009-04-02 Benjamin Kosnik <bkoz@redhat.com>
authorbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 2 Apr 2009 23:45:56 +0000 (23:45 +0000)
committerbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 2 Apr 2009 23:45:56 +0000 (23:45 +0000)
* testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc:
Change to mersenne_twister_engine, add same defaults as
mersenne_twister_engine/cons/default.cc.
* testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc: Same.

* include/bits/random.tcc (seed_seq::seed_seq): Uglify parameter
to __il.
* include/bits/random.h (mersenne_twister_engine): Qualify
_ShiftMin1 with namespace __detail.
(__detail::_ShiftMin1): Use __gnu_cxx::__numeric_traits::max until
constexpr std::numeric_limits::max() can be used.
(mersenne_twister_engine): Split apart static asserts into one
assert per message. Temporarily disable the last three.

2009-04-02  Edward Smith-Rowland  <3dw4rd@verizon.net>

* include/Makefile.am: Update to N2836. Modified for new random headers.
* include/Makefile.in: Ditto.
* include/tr1_impl/random: Moved to tr1/random.h
* include/tr1_impl/random.tcc: Moved to tr1
* include/tr1/random: Just point to moved tr1 random headers.
* include/tr1/random.tcc: Moved from tr1_impl.
* include/tr1/random.h: Moved from tr1_impl/random.
* include/std/random: Modified to point to std random headers.
* include/bits/random.tcc: New implementation of std random facilities.
* include/bits/random.h: Ditto.
* testsuite/26_numerics/headers/random/std_c++0x_neg.cc: Changed.
* testsuite/26_numerics/random/linear_congruential_engine/cons/
seed1.cc: New.
* testsuite/26_numerics/random/linear_congruential_engine/cons/
seed2.cc: New.
* testsuite/26_numerics/random/linear_congruential_engine/cons/
default.cc: New.
* testsuite/26_numerics/random/linear_congruential_engine/requirements/
non_uint_neg.cc: New.
* testsuite/26_numerics/random/linear_congruential_engine/requirements/
typedefs.cc: New.
* testsuite/26_numerics/random/linear_congruential_engine/operators/
equal.cc: New.
* testsuite/26_numerics/random/linear_congruential_engine/operators/
serialize.cc: New.
* testsuite/26_numerics/random/mersenne_twister_engine/cons/
seed1.cc: New.
* testsuite/26_numerics/random/mersenne_twister_engine/cons/
seed2.cc: New.
* testsuite/26_numerics/random/mersenne_twister_engine/cons/
default.cc: New.
* testsuite/26_numerics/random/mersenne_twister_engine/requirements/
typedefs.cc: New.
* testsuite/26_numerics/random/mersenne_twister_engine/operators/
equal.cc: New.
* testsuite/26_numerics/random/mersenne_twister_engine/operators/
serialize.cc: New.
* testsuite/26_numerics/random/subtract_with_carry_engine/cons/
seed1.cc: New.
* testsuite/26_numerics/random/subtract_with_carry_engine/cons/
seed2.cc: New.
* testsuite/26_numerics/random/subtract_with_carry_engine/cons/
default.cc: New.
* testsuite/26_numerics/random/subtract_with_carry_engine/requirements/
typedefs.cc: New.
* testsuite/26_numerics/random/subtract_with_carry_engine/operators/
equal.cc: New.
* testsuite/26_numerics/random/subtract_with_carry_engine/operators/
serialize.cc: New.
* testsuite/26_numerics/random/discard_block_engine/cons/
base_move.cc: New.
* testsuite/26_numerics/random/discard_block_engine/cons/
seed1.cc: New.
* testsuite/26_numerics/random/discard_block_engine/cons/
seed2.cc: New.
* testsuite/26_numerics/random/discard_block_engine/cons/
base_copy.cc: New.
* testsuite/26_numerics/random/discard_block_engine/cons/
default.cc: New.
* testsuite/26_numerics/random/discard_block_engine/cons/
seed_seq.cc: New.
* testsuite/26_numerics/random/discard_block_engine/requirements/
typedefs.cc: New.
* testsuite/26_numerics/random/discard_block_engine/operators/
equal.cc: New.
* testsuite/26_numerics/random/discard_block_engine/operators/
serialize.cc: New.
* testsuite/26_numerics/random/independent_bits_engine/cons/
base_move.cc: New.
* testsuite/26_numerics/random/independent_bits_engine/cons/
seed1.cc: New.
* testsuite/26_numerics/random/independent_bits_engine/cons/
seed2.cc: New.
* testsuite/26_numerics/random/independent_bits_engine/cons/
base_copy.cc: New.
* testsuite/26_numerics/random/independent_bits_engine/cons/
default.cc: New.
* testsuite/26_numerics/random/independent_bits_engine/cons/
seed_seq.cc: New.
* testsuite/26_numerics/random/independent_bits_engine/requirements/
typedefs.cc: New.
* testsuite/26_numerics/random/independent_bits_engine/operators/
equal.cc: New.
* testsuite/26_numerics/random/independent_bits_engine/operators/
serialize.cc: New.
* testsuite/26_numerics/random/shuffle_order_engine/cons/
base_move.cc: New.
* testsuite/26_numerics/random/shuffle_order_engine/cons/
seed1.cc: New.
* testsuite/26_numerics/random/shuffle_order_engine/cons/
seed2.cc: New.
* testsuite/26_numerics/random/shuffle_order_engine/cons/
base_copy.cc: New.
* testsuite/26_numerics/random/shuffle_order_engine/cons/
default.cc: New.
* testsuite/26_numerics/random/shuffle_order_engine/cons/
seed_seq.cc: New.
* testsuite/26_numerics/random/shuffle_order_engine/requirements/
typedefs.cc: New.
* testsuite/26_numerics/random/shuffle_order_engine/operators/
equal.cc: New.
* testsuite/26_numerics/random/shuffle_order_engine/operators/
serialize.cc
* testsuite/26_numerics/random/mt19937.cc: New.
* testsuite/26_numerics/random/mt19937_64.cc: New.
* testsuite/26_numerics/random/minstd_rand.cc: New.
* testsuite/26_numerics/random/minstd_rand0.cc: New.
* testsuite/26_numerics/random/ranlux24_base.cc: New.
* testsuite/26_numerics/random/ranlux48_base.cc: New.
* testsuite/26_numerics/random/ranlux24.cc: New.
* testsuite/26_numerics/random/ranlux48.cc: New.
* testsuite/26_numerics/random/knuth_b.cc: New.
* testsuite/26_numerics/random/default_random_engine.cc: New.
* testsuite/26_numerics/random/chi_squared_distribution/cons/
parms.cc: New.
* testsuite/26_numerics/random/chi_squared_distribution/cons/
default.cc: New.
* testsuite/26_numerics/random/chi_squared_distribution/requirements/
typedefs.cc: New.
* testsuite/26_numerics/random/chi_squared_distribution/operators/
serialize.cc: New.
* testsuite/26_numerics/random/normal_distribution/cons/
parms.cc: New.
* testsuite/26_numerics/random/normal_distribution/cons/
default.cc: New.
* testsuite/26_numerics/random/normal_distribution/requirements/
typedefs.cc: New.
* testsuite/26_numerics/random/normal_distribution/operators/
serialize.cc: New.
* testsuite/26_numerics/random/seed_seq/cons/range.cc: New.
* testsuite/26_numerics/random/seed_seq/cons/default.cc: New.
* testsuite/26_numerics/random/seed_seq/requirements/typedefs.cc: New.
* testsuite/26_numerics/random/uniform_int_distribution/cons/
parms_neg.cc: New.
* testsuite/26_numerics/random/uniform_int_distribution/cons/
parms.cc: New.
* testsuite/26_numerics/random/uniform_int_distribution/cons/
default.cc: New.
* testsuite/26_numerics/random/uniform_int_distribution/requirements/
typedefs.cc: New.
* testsuite/26_numerics/random/uniform_int_distribution/operators/
serialize.cc: New.
* testsuite/26_numerics/random/uniform_real_distribution/cons/
parms_neg.cc: New.
* testsuite/26_numerics/random/uniform_real_distribution/cons/
parms.cc: New.
* testsuite/26_numerics/random/uniform_real_distribution/cons/
default.cc: New.
* testsuite/26_numerics/random/uniform_real_distribution/requirements/
typedefs.cc: New.
* testsuite/26_numerics/random/uniform_real_distribution/operators/
serialize.cc: New.
* testsuite/26_numerics/random/poisson_distribution/cons/
parms.cc: New.
* testsuite/26_numerics/random/poisson_distribution/cons/
default.cc: New.
* testsuite/26_numerics/random/poisson_distribution/requirements/
typedefs.cc
* testsuite/26_numerics/random/poisson_distribution/operators/
serialize.cc: New.
* testsuite/26_numerics/random/bernoulli_distribution/cons/
parms.cc: New.
* testsuite/26_numerics/random/bernoulli_distribution/cons/
default.cc: New.
* testsuite/26_numerics/random/bernoulli_distribution/requirements/
typedefs.cc: New.
* testsuite/26_numerics/random/bernoulli_distribution/operators/
serialize.cc: New.
* testsuite/26_numerics/random/discrete_distribution/cons/
range.cc: New.
* testsuite/26_numerics/random/discrete_distribution/cons/
initlist.cc: New.
* testsuite/26_numerics/random/discrete_distribution/cons/
default.cc: New.
* testsuite/26_numerics/random/discrete_distribution/cons/
num_xbound_fun.cc: New.
* testsuite/26_numerics/random/discrete_distribution/requirements/
typedefs.cc: New.
* testsuite/26_numerics/random/discrete_distribution/operators/
serialize.cc: New.
* testsuite/26_numerics/random/weibull_distribution/cons/
parms.cc: New.
* testsuite/26_numerics/random/weibull_distribution/cons/
default.cc: New.
* testsuite/26_numerics/random/weibull_distribution/requirements/
typedefs.cc: New.
* testsuite/26_numerics/random/weibull_distribution/operators/
serialize.cc: New.
* testsuite/26_numerics/random/negative_binomial_distribution/cons/
parms.cc: New.
* testsuite/26_numerics/random/negative_binomial_distribution/cons/
default.cc: New.
* testsuite/26_numerics/random/negative_binomial_distribution/
requirements/typedefs.cc: New.
* testsuite/26_numerics/random/negative_binomial_distribution/
operators/serialize.cc: New.
* testsuite/26_numerics/random/cauchy_distribution/cons/
parms.cc: New.
* testsuite/26_numerics/random/cauchy_distribution/cons/
default.cc: New.
* testsuite/26_numerics/random/cauchy_distribution/requirements/
typedefs.cc: New.
* testsuite/26_numerics/random/cauchy_distribution/operators/
serialize.cc: New.
* testsuite/26_numerics/random/gamma_distribution/cons/
parms.cc: New.
* testsuite/26_numerics/random/gamma_distribution/cons/
default.cc: New.
* testsuite/26_numerics/random/gamma_distribution/requirements/
typedefs.cc: New.
* testsuite/26_numerics/random/gamma_distribution/operators/
serialize.cc: New.
* testsuite/26_numerics/random/fisher_f_distribution/cons/
parms.cc: New.
* testsuite/26_numerics/random/fisher_f_distribution/cons/
default.cc: New.
* testsuite/26_numerics/random/fisher_f_distribution/requirements/
typedefs.cc: New.
* testsuite/26_numerics/random/fisher_f_distribution/operators/
serialize.cc: New.

* testsuite/26_numerics/random/exponential_distribution/cons/
parms.cc: New.
* testsuite/26_numerics/random/exponential_distribution/cons/
default.cc: New.
* testsuite/26_numerics/random/exponential_distribution/requirements/
typedefs.cc: New.
* testsuite/26_numerics/random/exponential_distribution/operators/
serialize.cc: New.
* testsuite/26_numerics/random/lognormal_distribution/cons/
parms.cc: New.
* testsuite/26_numerics/random/lognormal_distribution/cons/
default.cc: New.
* testsuite/26_numerics/random/lognormal_distribution/requirements/
typedefs.cc: New.
* testsuite/26_numerics/random/lognormal_distribution/operators/
serialize.cc: New.
* testsuite/26_numerics/random/binomial_distribution/cons/
parms.cc: New.
* testsuite/26_numerics/random/binomial_distribution/cons/
default.cc: New.
* testsuite/26_numerics/random/binomial_distribution/requirements/
typedefs.cc: New.
* testsuite/26_numerics/random/binomial_distribution/operators/
serialize.cc: New.
* testsuite/26_numerics/random/random_device/cons/
token.cc: New.
* testsuite/26_numerics/random/random_device/cons/
default.cc: New.
* testsuite/26_numerics/random/random_device/requirements/
typedefs.cc: New.
* testsuite/26_numerics/random/extreme_value_distribution/cons/
parms.cc: New.
* testsuite/26_numerics/random/extreme_value_distribution/cons/
default.cc: New.
* testsuite/26_numerics/random/extreme_value_distribution/requirements/
typedefs.cc: New.
* testsuite/26_numerics/random/extreme_value_distribution/operators/
serialize.cc: New.
* testsuite/26_numerics/random/piecewise_linear_distribution/cons/
range.cc: New.
* testsuite/26_numerics/random/piecewise_linear_distribution/cons/
default.cc: New.
* testsuite/26_numerics/random/piecewise_linear_distribution/cons/
num_xbound_fun.cc: New.
* testsuite/26_numerics/random/piecewise_linear_distribution/cons/
initlist_fun.cc: New.
* testsuite/26_numerics/random/piecewise_linear_distribution/
requirements/typedefs.cc: New.
* testsuite/26_numerics/random/piecewise_linear_distribution/operators/
serialize.cc: New.
* testsuite/26_numerics/random/student_t_distribution/cons/
parms.cc: New.
* testsuite/26_numerics/random/student_t_distribution/cons/
default.cc: New.
* testsuite/26_numerics/random/student_t_distribution/requirements/
typedefs.cc: New.
* testsuite/26_numerics/random/student_t_distribution/operators/
serialize.cc: New.
* testsuite/26_numerics/random/geometric_distribution/cons/
parms.cc: New.
* testsuite/26_numerics/random/geometric_distribution/cons/
default.cc: New.
* testsuite/26_numerics/random/geometric_distribution/requirements/
typedefs.cc: New.
* testsuite/26_numerics/random/geometric_distribution/operators/
serialize.cc: New.
* testsuite/26_numerics/random/piecewise_constant_distribution/cons/
range.cc: New.
* testsuite/26_numerics/random/piecewise_constant_distribution/cons/
default.cc: New.
* testsuite/26_numerics/random/piecewise_constant_distribution/cons/
num_xbound_fun.cc: New.
* testsuite/26_numerics/random/piecewise_constant_distribution/cons/
initlist_fun.cc: New.
* testsuite/26_numerics/random/piecewise_constant_distribution/
requirements/typedefs.cc: New.
* testsuite/26_numerics/random/piecewise_constant_distribution/
operators/serialize.cc: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@145483 138bc75d-0d04-0410-961f-82ee72b054a4

165 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/include/Makefile.am
libstdc++-v3/include/Makefile.in
libstdc++-v3/include/bits/random.h [new file with mode: 0644]
libstdc++-v3/include/bits/random.tcc [new file with mode: 0644]
libstdc++-v3/include/std/random
libstdc++-v3/include/tr1/random
libstdc++-v3/include/tr1/random.h [new file with mode: 0644]
libstdc++-v3/include/tr1/random.tcc [new file with mode: 0644]
libstdc++-v3/include/tr1_impl/random
libstdc++-v3/include/tr1_impl/random.tcc
libstdc++-v3/testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc
libstdc++-v3/testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc
libstdc++-v3/testsuite/26_numerics/headers/random/std_c++0x_neg.cc
libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/cons/default.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/cons/parms.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/operators/serialize.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/cons/default.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/cons/parms.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/operators/serialize.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/cons/default.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/cons/parms.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/operators/serialize.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/cons/default.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/cons/parms.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/operators/serialize.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/default_random_engine.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/base_copy.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/base_move.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/default.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/seed1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/seed2.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/seed_seq.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/operators/equal.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/operators/serialize.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/default.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/initlist.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/num_xbound_fun.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/range.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/operators/serialize.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/cons/default.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/cons/parms.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/operators/serialize.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/cons/default.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/cons/parms.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/operators/serialize.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/cons/default.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/cons/parms.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/operators/serialize.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/cons/default.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/cons/parms.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/operators/serialize.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/cons/default.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/cons/parms.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/operators/serialize.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/base_copy.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/base_move.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/default.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/seed1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/seed2.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/seed_seq.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/operators/equal.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/operators/serialize.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/knuth_b.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/default.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/seed1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/seed2.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/operators/equal.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/operators/serialize.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/non_uint_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/cons/default.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/cons/parms.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/operators/serialize.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/default.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/seed1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/seed2.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/operators/equal.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/operators/serialize.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/minstd_rand.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/minstd_rand0.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/mt19937.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/mt19937_64.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/cons/default.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/cons/parms.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/serialize.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/normal_distribution/cons/default.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/normal_distribution/cons/parms.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/normal_distribution/operators/serialize.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/normal_distribution/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/default.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/initlist_fun.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/num_xbound_fun.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/range.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/operators/serialize.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/default.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/initlist_fun.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/num_xbound_fun.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/range.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/operators/serialize.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/cons/default.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/cons/parms.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/operators/serialize.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/random_device/cons/default.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/random_device/cons/token.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/random_device/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/ranlux24.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/ranlux24_base.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/ranlux48.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/ranlux48_base.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/default.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/initlist.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/range.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/seed_seq/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/base_copy.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/base_move.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/default.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/seed1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/seed2.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/seed_seq.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/operators/equal.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/operators/serialize.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/cons/default.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/cons/parms.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/operators/serialize.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/default.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/seed1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/seed2.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/operators/equal.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/operators/serialize.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/cons/default.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/cons/parms.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/cons/parms_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/operators/serialize.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/cons/default.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/cons/parms.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/cons/parms_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/serialize.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/requirements/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/cons/default.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/cons/parms.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/operators/serialize.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/requirements/typedefs.cc [new file with mode: 0644]

index 61b2c05..23954fb 100644 (file)
@@ -1,6 +1,324 @@
+2009-04-02  Benjamin Kosnik  <bkoz@redhat.com>
+
+       * testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc:
+       Change to mersenne_twister_engine, add same defaults as
+       mersenne_twister_engine/cons/default.cc.
+       * testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc: Same.
+
+       * include/bits/random.tcc (seed_seq::seed_seq): Uglify parameter
+       to __il.
+       * include/bits/random.h (mersenne_twister_engine): Qualify
+       _ShiftMin1 with namespace __detail.
+       (__detail::_ShiftMin1): Use __gnu_cxx::__numeric_traits::max until
+       constexpr std::numeric_limits::max() can be used.
+       (mersenne_twister_engine): Split apart static asserts into one
+       assert per message. Temporarily disable the last three.
+
+2009-04-02  Edward Smith-Rowland  <3dw4rd@verizon.net>
+
+       * include/Makefile.am: Update to N2836. Modified for new random headers.
+       * include/Makefile.in: Ditto.
+       * include/tr1_impl/random: Moved to tr1/random.h
+       * include/tr1_impl/random.tcc: Moved to tr1
+       * include/tr1/random: Just point to moved tr1 random headers.
+       * include/tr1/random.tcc: Moved from tr1_impl.
+       * include/tr1/random.h: Moved from tr1_impl/random.
+       * include/std/random: Modified to point to std random headers.
+       * include/bits/random.tcc: New implementation of std random facilities.
+       * include/bits/random.h: Ditto.
+       * testsuite/26_numerics/headers/random/std_c++0x_neg.cc: Changed.
+       * testsuite/26_numerics/random/linear_congruential_engine/cons/
+       seed1.cc: New.
+       * testsuite/26_numerics/random/linear_congruential_engine/cons/
+       seed2.cc: New.
+       * testsuite/26_numerics/random/linear_congruential_engine/cons/
+       default.cc: New.
+       * testsuite/26_numerics/random/linear_congruential_engine/requirements/
+       non_uint_neg.cc: New.
+       * testsuite/26_numerics/random/linear_congruential_engine/requirements/
+       typedefs.cc: New.
+       * testsuite/26_numerics/random/linear_congruential_engine/operators/
+       equal.cc: New.
+       * testsuite/26_numerics/random/linear_congruential_engine/operators/
+       serialize.cc: New.
+       * testsuite/26_numerics/random/mersenne_twister_engine/cons/
+       seed1.cc: New.
+       * testsuite/26_numerics/random/mersenne_twister_engine/cons/
+       seed2.cc: New.
+       * testsuite/26_numerics/random/mersenne_twister_engine/cons/
+       default.cc: New.
+       * testsuite/26_numerics/random/mersenne_twister_engine/requirements/
+       typedefs.cc: New.
+       * testsuite/26_numerics/random/mersenne_twister_engine/operators/
+       equal.cc: New.
+       * testsuite/26_numerics/random/mersenne_twister_engine/operators/
+       serialize.cc: New.
+       * testsuite/26_numerics/random/subtract_with_carry_engine/cons/
+       seed1.cc: New.
+       * testsuite/26_numerics/random/subtract_with_carry_engine/cons/
+       seed2.cc: New.
+       * testsuite/26_numerics/random/subtract_with_carry_engine/cons/
+       default.cc: New.
+       * testsuite/26_numerics/random/subtract_with_carry_engine/requirements/
+       typedefs.cc: New.
+       * testsuite/26_numerics/random/subtract_with_carry_engine/operators/
+       equal.cc: New.
+       * testsuite/26_numerics/random/subtract_with_carry_engine/operators/
+       serialize.cc: New.
+       * testsuite/26_numerics/random/discard_block_engine/cons/
+       base_move.cc: New.
+       * testsuite/26_numerics/random/discard_block_engine/cons/
+       seed1.cc: New.
+       * testsuite/26_numerics/random/discard_block_engine/cons/
+       seed2.cc: New.
+       * testsuite/26_numerics/random/discard_block_engine/cons/
+       base_copy.cc: New.
+       * testsuite/26_numerics/random/discard_block_engine/cons/
+       default.cc: New.
+       * testsuite/26_numerics/random/discard_block_engine/cons/
+       seed_seq.cc: New.
+       * testsuite/26_numerics/random/discard_block_engine/requirements/
+       typedefs.cc: New.
+       * testsuite/26_numerics/random/discard_block_engine/operators/
+       equal.cc: New.
+       * testsuite/26_numerics/random/discard_block_engine/operators/
+       serialize.cc: New.
+       * testsuite/26_numerics/random/independent_bits_engine/cons/
+       base_move.cc: New.
+       * testsuite/26_numerics/random/independent_bits_engine/cons/
+       seed1.cc: New.
+       * testsuite/26_numerics/random/independent_bits_engine/cons/
+       seed2.cc: New.
+       * testsuite/26_numerics/random/independent_bits_engine/cons/
+       base_copy.cc: New.
+       * testsuite/26_numerics/random/independent_bits_engine/cons/
+       default.cc: New.
+       * testsuite/26_numerics/random/independent_bits_engine/cons/
+       seed_seq.cc: New.
+       * testsuite/26_numerics/random/independent_bits_engine/requirements/
+       typedefs.cc: New.
+       * testsuite/26_numerics/random/independent_bits_engine/operators/
+       equal.cc: New.
+       * testsuite/26_numerics/random/independent_bits_engine/operators/
+       serialize.cc: New.
+       * testsuite/26_numerics/random/shuffle_order_engine/cons/
+       base_move.cc: New.
+       * testsuite/26_numerics/random/shuffle_order_engine/cons/
+       seed1.cc: New.
+       * testsuite/26_numerics/random/shuffle_order_engine/cons/
+       seed2.cc: New.
+       * testsuite/26_numerics/random/shuffle_order_engine/cons/
+       base_copy.cc: New.
+       * testsuite/26_numerics/random/shuffle_order_engine/cons/
+       default.cc: New.
+       * testsuite/26_numerics/random/shuffle_order_engine/cons/
+       seed_seq.cc: New.
+       * testsuite/26_numerics/random/shuffle_order_engine/requirements/
+       typedefs.cc: New.
+       * testsuite/26_numerics/random/shuffle_order_engine/operators/
+       equal.cc: New.
+       * testsuite/26_numerics/random/shuffle_order_engine/operators/
+       serialize.cc
+       * testsuite/26_numerics/random/mt19937.cc: New.
+       * testsuite/26_numerics/random/mt19937_64.cc: New.
+       * testsuite/26_numerics/random/minstd_rand.cc: New.
+       * testsuite/26_numerics/random/minstd_rand0.cc: New.
+       * testsuite/26_numerics/random/ranlux24_base.cc: New.
+       * testsuite/26_numerics/random/ranlux48_base.cc: New.
+       * testsuite/26_numerics/random/ranlux24.cc: New.
+       * testsuite/26_numerics/random/ranlux48.cc: New.
+       * testsuite/26_numerics/random/knuth_b.cc: New.
+       * testsuite/26_numerics/random/default_random_engine.cc: New.
+       * testsuite/26_numerics/random/chi_squared_distribution/cons/
+       parms.cc: New.
+       * testsuite/26_numerics/random/chi_squared_distribution/cons/
+       default.cc: New.
+       * testsuite/26_numerics/random/chi_squared_distribution/requirements/
+       typedefs.cc: New.
+       * testsuite/26_numerics/random/chi_squared_distribution/operators/
+       serialize.cc: New.
+       * testsuite/26_numerics/random/normal_distribution/cons/
+       parms.cc: New.
+       * testsuite/26_numerics/random/normal_distribution/cons/
+       default.cc: New.
+       * testsuite/26_numerics/random/normal_distribution/requirements/
+       typedefs.cc: New.
+       * testsuite/26_numerics/random/normal_distribution/operators/
+       serialize.cc: New.
+       * testsuite/26_numerics/random/seed_seq/cons/range.cc: New.
+       * testsuite/26_numerics/random/seed_seq/cons/default.cc: New.
+       * testsuite/26_numerics/random/seed_seq/requirements/typedefs.cc: New.
+       * testsuite/26_numerics/random/uniform_int_distribution/cons/
+       parms_neg.cc: New.
+       * testsuite/26_numerics/random/uniform_int_distribution/cons/
+       parms.cc: New.
+       * testsuite/26_numerics/random/uniform_int_distribution/cons/
+       default.cc: New.
+       * testsuite/26_numerics/random/uniform_int_distribution/requirements/
+       typedefs.cc: New.
+       * testsuite/26_numerics/random/uniform_int_distribution/operators/
+       serialize.cc: New.
+       * testsuite/26_numerics/random/uniform_real_distribution/cons/
+       parms_neg.cc: New.
+       * testsuite/26_numerics/random/uniform_real_distribution/cons/
+       parms.cc: New.
+       * testsuite/26_numerics/random/uniform_real_distribution/cons/
+       default.cc: New.
+       * testsuite/26_numerics/random/uniform_real_distribution/requirements/
+       typedefs.cc: New.
+       * testsuite/26_numerics/random/uniform_real_distribution/operators/
+       serialize.cc: New.
+       * testsuite/26_numerics/random/poisson_distribution/cons/
+       parms.cc: New.
+       * testsuite/26_numerics/random/poisson_distribution/cons/
+       default.cc: New.
+       * testsuite/26_numerics/random/poisson_distribution/requirements/
+       typedefs.cc
+       * testsuite/26_numerics/random/poisson_distribution/operators/
+       serialize.cc: New.
+       * testsuite/26_numerics/random/bernoulli_distribution/cons/
+       parms.cc: New.
+       * testsuite/26_numerics/random/bernoulli_distribution/cons/
+       default.cc: New.
+       * testsuite/26_numerics/random/bernoulli_distribution/requirements/
+       typedefs.cc: New.
+       * testsuite/26_numerics/random/bernoulli_distribution/operators/
+       serialize.cc: New.
+       * testsuite/26_numerics/random/discrete_distribution/cons/
+       range.cc: New.
+       * testsuite/26_numerics/random/discrete_distribution/cons/
+       initlist.cc: New.
+       * testsuite/26_numerics/random/discrete_distribution/cons/
+       default.cc: New.
+       * testsuite/26_numerics/random/discrete_distribution/cons/
+       num_xbound_fun.cc: New.
+       * testsuite/26_numerics/random/discrete_distribution/requirements/
+       typedefs.cc: New.
+       * testsuite/26_numerics/random/discrete_distribution/operators/
+       serialize.cc: New.
+       * testsuite/26_numerics/random/weibull_distribution/cons/
+       parms.cc: New.
+       * testsuite/26_numerics/random/weibull_distribution/cons/
+       default.cc: New.
+       * testsuite/26_numerics/random/weibull_distribution/requirements/
+       typedefs.cc: New.
+       * testsuite/26_numerics/random/weibull_distribution/operators/
+       serialize.cc: New.
+       * testsuite/26_numerics/random/negative_binomial_distribution/cons/
+       parms.cc: New.
+       * testsuite/26_numerics/random/negative_binomial_distribution/cons/
+       default.cc: New.
+       * testsuite/26_numerics/random/negative_binomial_distribution/
+       requirements/typedefs.cc: New.
+       * testsuite/26_numerics/random/negative_binomial_distribution/
+       operators/serialize.cc: New.
+       * testsuite/26_numerics/random/cauchy_distribution/cons/
+       parms.cc: New.
+       * testsuite/26_numerics/random/cauchy_distribution/cons/
+       default.cc: New.
+       * testsuite/26_numerics/random/cauchy_distribution/requirements/
+       typedefs.cc: New.
+       * testsuite/26_numerics/random/cauchy_distribution/operators/
+       serialize.cc: New.
+       * testsuite/26_numerics/random/gamma_distribution/cons/
+       parms.cc: New.
+       * testsuite/26_numerics/random/gamma_distribution/cons/
+       default.cc: New.
+       * testsuite/26_numerics/random/gamma_distribution/requirements/
+       typedefs.cc: New.
+       * testsuite/26_numerics/random/gamma_distribution/operators/
+       serialize.cc: New.
+       * testsuite/26_numerics/random/fisher_f_distribution/cons/
+       parms.cc: New.
+       * testsuite/26_numerics/random/fisher_f_distribution/cons/
+       default.cc: New.
+       * testsuite/26_numerics/random/fisher_f_distribution/requirements/
+       typedefs.cc: New.
+       * testsuite/26_numerics/random/fisher_f_distribution/operators/
+       serialize.cc: New.
+
+       * testsuite/26_numerics/random/exponential_distribution/cons/
+       parms.cc: New.
+       * testsuite/26_numerics/random/exponential_distribution/cons/
+       default.cc: New.
+       * testsuite/26_numerics/random/exponential_distribution/requirements/
+       typedefs.cc: New.
+       * testsuite/26_numerics/random/exponential_distribution/operators/
+       serialize.cc: New.
+       * testsuite/26_numerics/random/lognormal_distribution/cons/
+       parms.cc: New.
+       * testsuite/26_numerics/random/lognormal_distribution/cons/
+       default.cc: New.
+       * testsuite/26_numerics/random/lognormal_distribution/requirements/
+       typedefs.cc: New.
+       * testsuite/26_numerics/random/lognormal_distribution/operators/
+       serialize.cc: New.
+       * testsuite/26_numerics/random/binomial_distribution/cons/
+       parms.cc: New.
+       * testsuite/26_numerics/random/binomial_distribution/cons/
+       default.cc: New.
+       * testsuite/26_numerics/random/binomial_distribution/requirements/
+       typedefs.cc: New.
+       * testsuite/26_numerics/random/binomial_distribution/operators/
+       serialize.cc: New.
+       * testsuite/26_numerics/random/random_device/cons/
+       token.cc: New.
+       * testsuite/26_numerics/random/random_device/cons/
+       default.cc: New.
+       * testsuite/26_numerics/random/random_device/requirements/
+       typedefs.cc: New.
+       * testsuite/26_numerics/random/extreme_value_distribution/cons/
+       parms.cc: New.
+       * testsuite/26_numerics/random/extreme_value_distribution/cons/
+       default.cc: New.
+       * testsuite/26_numerics/random/extreme_value_distribution/requirements/
+       typedefs.cc: New.
+       * testsuite/26_numerics/random/extreme_value_distribution/operators/
+       serialize.cc: New.
+       * testsuite/26_numerics/random/piecewise_linear_distribution/cons/
+       range.cc: New.
+       * testsuite/26_numerics/random/piecewise_linear_distribution/cons/
+       default.cc: New.
+       * testsuite/26_numerics/random/piecewise_linear_distribution/cons/
+       num_xbound_fun.cc: New.
+       * testsuite/26_numerics/random/piecewise_linear_distribution/cons/
+       initlist_fun.cc: New.
+       * testsuite/26_numerics/random/piecewise_linear_distribution/
+       requirements/typedefs.cc: New.
+       * testsuite/26_numerics/random/piecewise_linear_distribution/operators/
+       serialize.cc: New.
+       * testsuite/26_numerics/random/student_t_distribution/cons/
+       parms.cc: New.
+       * testsuite/26_numerics/random/student_t_distribution/cons/
+       default.cc: New.
+       * testsuite/26_numerics/random/student_t_distribution/requirements/
+       typedefs.cc: New.
+       * testsuite/26_numerics/random/student_t_distribution/operators/
+       serialize.cc: New.
+       * testsuite/26_numerics/random/geometric_distribution/cons/
+       parms.cc: New.
+       * testsuite/26_numerics/random/geometric_distribution/cons/
+       default.cc: New.
+       * testsuite/26_numerics/random/geometric_distribution/requirements/
+       typedefs.cc: New.
+       * testsuite/26_numerics/random/geometric_distribution/operators/
+       serialize.cc: New.
+       * testsuite/26_numerics/random/piecewise_constant_distribution/cons/
+       range.cc: New.
+       * testsuite/26_numerics/random/piecewise_constant_distribution/cons/
+       default.cc: New.
+       * testsuite/26_numerics/random/piecewise_constant_distribution/cons/
+       num_xbound_fun.cc: New.
+       * testsuite/26_numerics/random/piecewise_constant_distribution/cons/
+       initlist_fun.cc: New.
+       * testsuite/26_numerics/random/piecewise_constant_distribution/
+       requirements/typedefs.cc: New.
+       * testsuite/26_numerics/random/piecewise_constant_distribution/
+       operators/serialize.cc: New.
+
 2009-04-02  Dodji Seketeli  <dodji@redhat.com>
 
-       * include/ext/bitmap_allocator.h: the typedefs should be made public
+       * include/ext/bitmap_allocator.h: The typedefs should be made public
        if we want them to be accessible. This has been revealed by the patch
        that fixes PR c++/26693 in g++.
 
index 5205e70..6b481ce 100644 (file)
@@ -116,6 +116,8 @@ bits_headers = \
        ${bits_srcdir}/ostream.tcc \
        ${bits_srcdir}/ostream_insert.h \
        ${bits_srcdir}/postypes.h \
+       ${bits_srcdir}/random.h \
+       ${bits_srcdir}/random.tcc \
        ${bits_srcdir}/stream_iterator.h \
        ${bits_srcdir}/streambuf_iterator.h \
        ${bits_srcdir}/shared_ptr.h \
@@ -570,6 +572,8 @@ tr1_headers = \
        ${tr1_srcdir}/poly_laguerre.tcc \
        ${tr1_srcdir}/legendre_function.tcc \
        ${tr1_srcdir}/random \
+       ${tr1_srcdir}/random.h \
+       ${tr1_srcdir}/random.tcc \
        ${tr1_srcdir}/regex \
        ${tr1_srcdir}/riemann_zeta.tcc \
        ${tr1_srcdir}/shared_ptr.h \
@@ -608,8 +612,6 @@ tr1_impl_headers = \
        ${tr1_impl_srcdir}/functional_hash.h \
        ${tr1_impl_srcdir}/hashtable \
        ${tr1_impl_srcdir}/hashtable_policy.h \
-       ${tr1_impl_srcdir}/random \
-       ${tr1_impl_srcdir}/random.tcc \
        ${tr1_impl_srcdir}/regex \
        ${tr1_impl_srcdir}/type_traits \
        ${tr1_impl_srcdir}/unordered_map \
index ae85f7e..c1ad2d3 100644 (file)
@@ -381,6 +381,8 @@ bits_headers = \
        ${bits_srcdir}/ostream.tcc \
        ${bits_srcdir}/ostream_insert.h \
        ${bits_srcdir}/postypes.h \
+       ${bits_srcdir}/random.h \
+       ${bits_srcdir}/random.tcc \
        ${bits_srcdir}/stream_iterator.h \
        ${bits_srcdir}/streambuf_iterator.h \
        ${bits_srcdir}/shared_ptr.h \
@@ -833,6 +835,8 @@ tr1_headers = \
        ${tr1_srcdir}/poly_laguerre.tcc \
        ${tr1_srcdir}/legendre_function.tcc \
        ${tr1_srcdir}/random \
+       ${tr1_srcdir}/random.h \
+       ${tr1_srcdir}/random.tcc \
        ${tr1_srcdir}/regex \
        ${tr1_srcdir}/riemann_zeta.tcc \
        ${tr1_srcdir}/shared_ptr.h \
@@ -870,8 +874,6 @@ tr1_impl_headers = \
        ${tr1_impl_srcdir}/functional_hash.h \
        ${tr1_impl_srcdir}/hashtable \
        ${tr1_impl_srcdir}/hashtable_policy.h \
-       ${tr1_impl_srcdir}/random \
-       ${tr1_impl_srcdir}/random.tcc \
        ${tr1_impl_srcdir}/regex \
        ${tr1_impl_srcdir}/type_traits \
        ${tr1_impl_srcdir}/unordered_map \
diff --git a/libstdc++-v3/include/bits/random.h b/libstdc++-v3/include/bits/random.h
new file mode 100644 (file)
index 0000000..ad64a90
--- /dev/null
@@ -0,0 +1,4940 @@
+// random number generation -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/**
+ * @file bits/random.h
+ *  This is an internal header file, included by other library headers.
+ *  You should not attempt to use it directly.
+ */
+
+#include <vector>
+
+namespace std
+{
+
+  // [26.4] Random number generation
+
+  /**
+   * @addtogroup std_random Random Number Generation
+   * A facility for generating random numbers on selected distributions.
+   * @{
+   */
+
+  /**
+   * @brief A function template for converting the output of a (integral)
+   * uniform random number generator to a floatng point result in the range
+   * [0-1).
+   */
+  template<typename _RealType, size_t __bits,
+          typename _UniformRandomNumberGenerator>
+    _RealType
+    generate_canonical(_UniformRandomNumberGenerator& __g);
+
+  class seed_seq;
+
+  /*
+   * Implementation-space details.
+   */
+  namespace __detail
+  {
+    template<typename _UIntType, size_t __w,
+            bool = __w < static_cast<size_t>(std::numeric_limits<_UIntType>::digits)>
+      struct _Shift
+      { static const _UIntType __value = 0; };
+
+    template<typename _UIntType, size_t __w>
+      struct _Shift<_UIntType, __w, true>
+      { static const _UIntType __value = _UIntType(1) << __w; };
+
+    // XXX need constexpr
+    template<typename _UIntType, size_t __w,
+            bool = __w <static_cast<size_t>(std::numeric_limits<_UIntType>::digits)>
+      struct _ShiftMin1
+      { static const _UIntType __value = __gnu_cxx::__numeric_traits<_UIntType>::max; };
+
+    template<typename _UIntType, size_t __w>
+      struct _ShiftMin1<_UIntType, __w, true>
+      { static const _UIntType __value = _UIntType(1) << __w - _UIntType(1); };
+
+    template<typename _Tp, _Tp __a, _Tp __c, _Tp __m, bool>
+      struct _Mod;
+
+    // Dispatch based on modulus value to prevent divide-by-zero compile-time
+    // errors when m == 0.
+    template<typename _Tp, _Tp __a, _Tp __c, _Tp __m>
+      inline _Tp
+      __mod(_Tp __x)
+      { return _Mod<_Tp, __a, __c, __m, __m == 0>::__calc(__x); }
+
+    typedef __gnu_cxx::__conditional_type<(sizeof(unsigned) == 4),
+                   unsigned, unsigned long>::__type _UInt32Type;
+
+    /*
+     * An adaptor class for converting the output of any Generator into
+     * the input for a specific Distribution.
+     */
+    template<typename _Engine, typename _DInputType>
+      struct _Adaptor
+      {
+
+      public:
+       _Adaptor(_Engine& __g)
+       : _M_g(__g) { }
+
+       _DInputType
+       min() const
+       {
+         if (is_integral<_DInputType>::value)
+           return _M_g.min();
+         else
+           return _DInputType(0);
+       }
+
+       _DInputType
+       max() const
+       {
+         if (is_integral<_DInputType>::value)
+           return _M_g.max();
+         else
+           return _DInputType(1);
+       }
+
+       /*
+        * Converts a value generated by the adapted random number generator
+        * into a value in the input domain for the dependent random number
+        * distribution.
+        *
+        * Because the type traits are compile time constants only the
+        * appropriate clause of the if statements will actually be emitted
+        * by the compiler.
+        */
+       _DInputType
+       operator()()
+       {
+         if (is_integral<_DInputType>::value)
+           return _M_g();
+         else
+           return generate_canonical<_DInputType,
+                                     numeric_limits<_DInputType>::digits,
+                                     _Engine>(_M_g);
+       }
+
+      private:
+       _Engine& _M_g;
+      };
+  } // namespace __detail
+
+  /**
+   * @addtogroup std_random_generators Random Number Generators
+   * @ingroup std_random
+   *
+   * These classes define objects which provide random or pseudorandom
+   * numbers, either from a discrete or a continuous interval.  The
+   * random number generator supplied as a part of this library are
+   * all uniform random number generators which provide a sequence of
+   * random number uniformly distributed over their range.
+   *
+   * A number generator is a function object with an operator() that
+   * takes zero arguments and returns a number.
+   *
+   * A compliant random number generator must satisfy the following
+   * requirements.  <table border=1 cellpadding=10 cellspacing=0>
+   * <caption align=top>Random Number Generator Requirements</caption>
+   * <tr><td>To be documented.</td></tr> </table>
+   *
+   * @{
+   */
+
+  /**
+   * @brief A model of a linear congruential random number generator.
+   *
+   * A random number generator that produces pseudorandom numbers using the
+   * linear function @f$x_{i+1}\leftarrow(ax_{i} + c) \bmod m @f$.
+   *
+   * The template parameter @p _UIntType must be an unsigned integral type
+   * large enough to store values up to (__m-1). If the template parameter
+   * @p __m is 0, the modulus @p __m used is
+   * std::numeric_limits<_UIntType>::max() plus 1. Otherwise, the template
+   * parameters @p __a and @p __c must be less than @p __m.
+   *
+   * The size of the state is @f$ 1 @f$.
+   */
+  template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+    class linear_congruential_engine
+    {
+      __glibcxx_class_requires(_UIntType, _UnsignedIntegerConcept)
+      static_assert(__m == 0 || (__a < __m && __c < __m),
+                   "template arguments out of bounds"
+                   " in linear_congruential_engine");
+
+    public:
+      /** The type of the generated random value. */
+      typedef _UIntType result_type;
+
+      /** The multiplier. */
+      static const result_type multiplier   = __a;
+      /** An increment. */
+      static const result_type increment    = __c;
+      /** The modulus. */
+      static const result_type modulus      = __m;
+      static const result_type default_seed = 1UL;
+
+      /**
+       * @brief Constructs a %linear_congruential_engine random number
+       *        generator engine with seed @p __s.  The default seed value
+       *        is 1.
+       *
+       * @param __s The initial seed value.
+       */
+      explicit
+      linear_congruential_engine(result_type __s = default_seed)
+      { this->seed(__s); }
+
+      /**
+       * @brief Constructs a %linear_congruential_engine random number
+       *        generator engine seeded from the seed sequence @p __q.
+       *
+       * @param __q the seed sequence.
+       */
+      explicit
+      linear_congruential_engine(seed_seq& __q)
+      { this->seed(__q); }
+
+      /**
+       * @brief Reseeds the %linear_congruential_engine random number generator
+       *        engine sequence to the seed @g __s.
+       *
+       * @param __s The new seed.
+       */
+      void
+      seed(result_type __s = default_seed);
+
+      /**
+       * @brief Reseeds the %linear_congruential_engine random number generator
+       *        engine
+       * sequence using values from the seed sequence @p __q.
+       *
+       * @param __q the seed sequence.
+       */
+      void
+      seed(seed_seq& __q);
+
+      /**
+       * @brief Gets the smallest possible value in the output range.
+       *
+       * The minimum depends on the @p __c parameter: if it is zero, the
+       * minimum generated must be > 0, otherwise 0 is allowed.
+       *
+       * @todo This should be constexpr.
+       */
+      result_type
+      min() const
+      { return (__detail::__mod<_UIntType, 1, 0, __m>(__c) == 0) ? 1 : 0; }
+
+      /**
+       * @brief Gets the largest possible value in the output range.
+       *
+       * @todo This should be constexpr.
+       */
+      result_type
+      max() const
+      { return __m - 1; }
+
+      /**
+       * @brief Discard a sequence of random numbers.
+       *
+       * @todo Look for a faster way to do discard.
+       */
+      void
+      discard(unsigned long long __z)
+      {
+       for (; __z != 0ULL; --__z)
+         (*this)();
+      }
+
+      /**
+       * @brief Gets the next random number in the sequence.
+       */
+      result_type
+      operator()();
+
+      /**
+       * @brief Compares two linear congruential random number generator
+       * objects of the same type for equality.
+       *
+       * @param __lhs A linear congruential random number generator object.
+       * @param __rhs Another linear congruential random number generator
+       *              object.
+       *
+       * @returns true if the two objects are equal, false otherwise.
+       */
+      friend bool
+      operator==(const linear_congruential_engine& __lhs,
+                const linear_congruential_engine& __rhs)
+      { return __lhs._M_x == __rhs._M_x; }
+
+      /**
+       * @brief Writes the textual representation of the state x(i) of x to
+       *        @p __os.
+       *
+       * @param __os  The output stream.
+       * @param __lcr A % linear_congruential_engine random number generator.
+       * @returns __os.
+       */
+      template<typename _UIntType1, _UIntType1 __a1, _UIntType1 __c1,
+              _UIntType1 __m1,
+              typename _CharT, typename _Traits>
+       friend std::basic_ostream<_CharT, _Traits>&
+       operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+                  const linear_congruential_engine<_UIntType1, __a1, __c1,
+                  __m1>& __lcr);
+
+      /**
+       * @brief Sets the state of the engine by reading its textual
+       *        representation from @p __is.
+       *
+       * The textual representation must have been previously written using
+       * an output stream whose imbued locale and whose type's template
+       * specialization arguments _CharT and _Traits were the same as those
+       * of @p __is.
+       *
+       * @param __is  The input stream.
+       * @param __lcr A % linear_congruential_engine random number generator.
+       * @returns __is.
+       */
+      template<typename _UIntType1, _UIntType1 __a1, _UIntType1 __c1,
+              _UIntType1 __m1,
+              typename _CharT, typename _Traits>
+       friend std::basic_istream<_CharT, _Traits>&
+       operator>>(std::basic_istream<_CharT, _Traits>& __is,
+                  linear_congruential_engine<_UIntType1,
+                                             __a1, __c1, __m1>& __lcr);
+
+    private:
+      template<typename _Gen>
+       void
+       seed(_Gen& __g, true_type)
+       { return seed(static_cast<unsigned long>(__g)); }
+
+      template<typename _Gen>
+       void
+       seed(_Gen& __g, false_type);
+
+      _UIntType _M_x;
+    };
+
+
+  /**
+   * A generalized feedback shift register discrete random number generator.
+   *
+   * This algorithm avoids multiplication and division and is designed to be
+   * friendly to a pipelined architecture.  If the parameters are chosen
+   * correctly, this generator will produce numbers with a very long period and
+   * fairly good apparent entropy, although still not cryptographically strong.
+   *
+   * The best way to use this generator is with the predefined mt19937 class.
+   *
+   * This algorithm was originally invented by Makoto Matsumoto and
+   * Takuji Nishimura.
+   *
+   * @var word_size   The number of bits in each element of the state vector.
+   * @var state_size  The degree of recursion.
+   * @var shift_size  The period parameter.
+   * @var mask_bits   The separation point bit index.
+   * @var parameter_a The last row of the twist matrix.
+   * @var output_u    The first right-shift tempering matrix parameter.
+   * @var output_s    The first left-shift tempering matrix parameter.
+   * @var output_b    The first left-shift tempering matrix mask.
+   * @var output_t    The second left-shift tempering matrix parameter.
+   * @var output_c    The second left-shift tempering matrix mask.
+   * @var output_l    The second right-shift tempering matrix parameter.
+   */
+  template<typename _UIntType, size_t __w,
+          size_t __n, size_t __m, size_t __r,
+          _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+          _UIntType __b, size_t __t,
+          _UIntType __c, size_t __l, _UIntType __f>
+    class mersenne_twister_engine
+    {
+      __glibcxx_class_requires(_UIntType, _UnsignedIntegerConcept)
+
+      static_assert(__m >= 1U, 
+                   "mersenne_twister_engine template arguments out of bounds");
+      static_assert(__n >= __m,
+                   "mersenne_twister_engine template arguments out of bounds");
+      static_assert(__w >= __r,
+                   "mersenne_twister_engine template arguments out of bounds");
+      static_assert(__w >= __u,
+                   "mersenne_twister_engine template arguments out of bounds");
+      static_assert(__w >= __s,
+                   "mersenne_twister_engine template arguments out of bounds");
+      static_assert(__w >= __t,
+                   "mersenne_twister_engine template arguments out of bounds");
+      static_assert(__w >= __l,
+                   "mersenne_twister_engine template arguments out of bounds");
+      static_assert(__w <= static_cast<size_t>(numeric_limits<_UIntType>::digits), 
+                   "mersenne_twister_engine template arguments out of bounds");
+
+#if 0
+      // XXX
+      static_assert(__a <= __detail::_ShiftMin1<_UIntType, __w>::__value,
+                   "mersenne_twister_engine template arguments out of bounds");
+      static_assert(__b <= __detail::_ShiftMin1<_UIntType, __w>::__value,
+                   "mersenne_twister_engine template arguments out of bounds");
+      static_assert(__c <= __detail::_ShiftMin1<_UIntType, __w>::__value,
+                   "mersenne_twister_engine template arguments out of bounds");
+#endif
+
+    public:
+      /** The type of the generated random value. */
+      typedef _UIntType result_type;
+
+      // parameter values
+      static const size_t      word_size                 = __w;
+      static const size_t      state_size                = __n;
+      static const size_t      shift_size                = __m;
+      static const size_t      mask_bits                 = __r;
+      static const result_type xor_mask                  = __a;
+      static const size_t      tempering_u               = __u;
+      static const result_type tempering_d               = __d;
+      static const size_t      tempering_s               = __s;
+      static const result_type tempering_b               = __b;
+      static const size_t      tempering_t               = __t;
+      static const result_type tempering_c               = __c;
+      static const size_t      tempering_l               = __l;
+      static const size_t      initialization_multiplier = __f;
+      static const result_type default_seed = 5489UL;
+
+      // constructors and member function
+      explicit
+      mersenne_twister_engine(result_type __sd = default_seed)
+      { seed(__sd); }
+
+      /**
+       * @brief Constructs a %mersenne_twister_engine random number generator
+       *        engine seeded from the seed sequence @p __q.
+       *
+       * @param __q the seed sequence.
+       */
+      explicit
+      mersenne_twister_engine(seed_seq& __q)
+      { seed(__q); }
+
+      void
+      seed(result_type __sd = default_seed);
+
+      void
+      seed(seed_seq& __q);
+
+      /**
+       * @brief Gets the smallest possible value in the output range.
+       *
+       * @todo This should be constexpr.
+       */
+      result_type
+      min() const
+      { return 0; };
+
+      /**
+       * @brief Gets the largest possible value in the output range.
+       *
+       * @todo This should be constexpr.
+       */
+      result_type
+      max() const
+      { return __detail::_ShiftMin1<_UIntType, __w>::__value; }
+
+      /**
+       * @brief Discard a sequence of random numbers.
+       *
+       * @todo Look for a faster way to do discard.
+       */
+      void
+      discard(unsigned long long __z)
+      {
+       for (; __z != 0ULL; --__z)
+         (*this)();
+      }
+
+      result_type
+      operator()();
+
+      /**
+       * @brief Compares two % mersenne_twister_engine random number generator
+       *        objects of the same type for equality.
+       *
+       * @param __lhs A % mersenne_twister_engine random number generator
+       *              object.
+       * @param __rhs Another % mersenne_twister_engine random number
+       *              generator object.
+       *
+       * @returns true if the two objects are equal, false otherwise.
+       */
+      friend bool
+      operator==(const mersenne_twister_engine& __lhs,
+                const mersenne_twister_engine& __rhs)
+      { return std::equal(__lhs._M_x, __lhs._M_x + state_size, __rhs._M_x); }
+
+      /**
+       * @brief Inserts the current state of a % mersenne_twister_engine
+       *        random number generator engine @p __x into the output stream
+       *        @p __os.
+       *
+       * @param __os An output stream.
+       * @param __x  A % mersenne_twister_engine random number generator
+       *             engine.
+       *
+       * @returns The output stream with the state of @p __x inserted or in
+       * an error state.
+       */
+      template<typename _UIntType1,
+              size_t __w1, size_t __n1,
+              size_t __m1, size_t __r1,
+              _UIntType1 __a1, size_t __u1,
+              _UIntType1 __d1, size_t __s1,
+              _UIntType1 __b1, size_t __t1,
+              _UIntType1 __c1, size_t __l1, _UIntType1 __f1,
+              typename _CharT, typename _Traits>
+       friend std::basic_ostream<_CharT, _Traits>&
+       operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+                  const mersenne_twister_engine<_UIntType1, __w1, __n1, __m1, __r1,
+                  __a1, __u1, __d1, __s1, __b1, __t1, __c1, __l1, __f1>& __x);
+
+      /**
+       * @brief Extracts the current state of a % mersenne_twister_engine
+       *        random number generator engine @p __x from the input stream
+       *        @p __is.
+       *
+       * @param __is An input stream.
+       * @param __x  A % mersenne_twister_engine random number generator
+       *             engine.
+       *
+       * @returns The input stream with the state of @p __x extracted or in
+       * an error state.
+       */
+      template<typename _UIntType1,
+              size_t __w1, size_t __n1,
+              size_t __m1, size_t __r1,
+              _UIntType1 __a1, size_t __u1,
+              _UIntType1 __d1, size_t __s1,
+              _UIntType1 __b1, size_t __t1,
+              _UIntType1 __c1, size_t __l1, _UIntType1 __f1,
+              typename _CharT, typename _Traits>
+       friend std::basic_istream<_CharT, _Traits>&
+       operator>>(std::basic_istream<_CharT, _Traits>& __is,
+                  mersenne_twister_engine<_UIntType1, __w1, __n1, __m1, __r1,
+                  __a1, __u1, __d1, __s1, __b1, __t1, __c1, __l1, __f1>& __x);
+
+    private:
+      template<typename _Gen>
+       void
+       seed(_Gen& __g, true_type)
+       { return seed(static_cast<unsigned long>(__g)); }
+
+      template<typename _Gen>
+       void
+       seed(_Gen& __g, false_type);
+
+      _UIntType _M_x[state_size];
+      size_t    _M_p;
+    };
+
+  /**
+   * @brief The Marsaglia-Zaman generator.
+   *
+   * This is a model of a Generalized Fibonacci discrete random number
+   * generator, sometimes referred to as the SWC generator.
+   *
+   * A discrete random number generator that produces pseudorandom
+   * numbers using @f$x_{i}\leftarrow(x_{i - s} - x_{i - r} -
+   * carry_{i-1}) \bmod m @f$.
+   *
+   * The size of the state is @f$ r @f$
+   * and the maximum period of the generator is @f$ m^r - m^s - 1 @f$.
+   *
+   * @var _M_x     The state of the generator.  This is a ring buffer.
+   * @var _M_carry The carry.
+   * @var _M_p     Current index of x(i - r).
+   */
+  template<typename _UIntType, size_t __w, size_t __s, size_t __r>
+    class subtract_with_carry_engine
+    {
+      __glibcxx_class_requires(_UIntType, _UnsignedIntegerConcept)
+      static_assert(__s > 0U && __r > __s
+                && __w > 0U
+                && __w <= static_cast<size_t>(numeric_limits<_UIntType>::digits),
+                   "template arguments out of bounds"
+                   " in subtract_with_carry_engine");
+
+    public:
+      /** The type of the generated random value. */
+      typedef _UIntType result_type;
+
+      // parameter values
+      static const size_t      word_size    = __w;
+      static const size_t      short_lag    = __s;
+      static const size_t      long_lag     = __r;
+      static const result_type default_seed = 19780503;
+
+      /**
+       * @brief Constructs an explicitly seeded % subtract_with_carry_engine
+       *        random number generator.
+       */
+      explicit
+      subtract_with_carry_engine(result_type __sd = default_seed)
+      { this->seed(__sd); }
+
+      /**
+       * @brief Constructs a %subtract_with_carry_engine random number engine
+       *        seeded from the seed sequence @p __q.
+       *
+       * @param __q the seed sequence.
+       */
+      explicit
+      subtract_with_carry_engine(seed_seq& __q)
+      { this->seed(__q); }
+
+      /**
+       * @brief Seeds the initial state @f$ x_0 @f$ of the random number
+       *        generator.
+       *
+       * N1688[4.19] modifies this as follows.  If @p __value == 0,
+       * sets value to 19780503.  In any case, with a linear
+       * congruential generator lcg(i) having parameters @f$ m_{lcg} =
+       * 2147483563, a_{lcg} = 40014, c_{lcg} = 0, and lcg(0) = value
+       * @f$, sets @f$ x_{-r} \dots x_{-1} @f$ to @f$ lcg(1) \bmod m
+       * \dots lcg(r) \bmod m @f$ respectively.  If @f$ x_{-1} = 0 @f$
+       * set carry to 1, otherwise sets carry to 0.
+       */
+      void
+      seed(result_type __sd = default_seed);
+
+      /**
+       * @brief Seeds the initial state @f$ x_0 @f$ of the
+       * % subtract_with_carry_engine random number generator.
+       */
+      void
+      seed(seed_seq& __q);
+
+      /**
+       * @brief Gets the inclusive minimum value of the range of random
+       * integers returned by this generator.
+       *
+       * @todo This should be constexpr.
+       */
+      result_type
+      min() const
+      { return 0; }
+
+      /**
+       * @brief Gets the inclusive maximum value of the range of random
+       * integers returned by this generator.
+       *
+       * @todo This should be constexpr.
+       */
+      result_type
+      max() const
+      { return _S_modulus - 1U; }
+
+      /**
+       * @brief Discard a sequence of random numbers.
+       *
+       * @todo Look for a faster way to do discard.
+       */
+      void
+      discard(unsigned long long __z)
+      {
+       for (; __z != 0ULL; --__z)
+         (*this)();
+      }
+
+      /**
+       * @brief Gets the next random number in the sequence.
+       */
+      result_type
+      operator()();
+
+      /**
+       * @brief Compares two % subtract_with_carry_engine random number
+       *        generator objects of the same type for equality.
+       *
+       * @param __lhs A % subtract_with_carry_engine random number generator
+       *              object.
+       * @param __rhs Another % subtract_with_carry_engine random number
+       *              generator object.
+       *
+       * @returns true if the two objects are equal, false otherwise.
+       */
+      friend bool
+      operator==(const subtract_with_carry_engine& __lhs,
+                const subtract_with_carry_engine& __rhs)
+      { return std::equal(__lhs._M_x, __lhs._M_x + long_lag, __rhs._M_x); }
+
+      /**
+       * @brief Inserts the current state of a % subtract_with_carry_engine
+       *        random number generator engine @p __x into the output stream
+       *        @p __os.
+       *
+       * @param __os An output stream.
+       * @param __x  A % subtract_with_carry_engine random number generator
+       *             engine.
+       *
+       * @returns The output stream with the state of @p __x inserted or in
+       * an error state.
+       */
+      template<typename _UIntType1, size_t __w1, size_t __s1, size_t __r1,
+              typename _CharT, typename _Traits>
+       friend std::basic_ostream<_CharT, _Traits>&
+       operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+                  const subtract_with_carry_engine<_UIntType1, __w1, __s1,
+                  __r1>& __x);
+
+      /**
+       * @brief Extracts the current state of a % subtract_with_carry_engine
+       *        random number generator engine @p __x from the input stream
+       *        @p __is.
+       *
+       * @param __is An input stream.
+       * @param __x  A % subtract_with_carry_engine random number generator engine.
+       *
+       * @returns The input stream with the state of @p __x extracted or in
+       * an error state.
+       */
+      template<typename _UIntType1, size_t __w1, size_t __s1, size_t __r1,
+              typename _CharT, typename _Traits>
+       friend std::basic_istream<_CharT, _Traits>&
+       operator>>(std::basic_istream<_CharT, _Traits>& __is,
+                  subtract_with_carry_engine<_UIntType1, __w1, __s1, __r1>& __x);
+
+    private:
+      template<typename _Gen>
+       void
+       seed(_Gen& __g, true_type)
+       { return seed(static_cast<unsigned long>(__g)); }
+
+      template<typename _Gen>
+       void
+       seed(_Gen& __g, false_type);
+
+      static const size_t _S_modulus
+       = __detail::_Shift<_UIntType, __w>::__value;
+
+      _UIntType  _M_x[long_lag];
+      _UIntType  _M_carry;
+      size_t     _M_p;
+    };
+
+  /**
+   * Produces random numbers from some base engine by discarding blocks of
+   * data.
+   *
+   * 0 <= @p __r <= @p __p
+   */
+  template<typename _RandomNumberEngine, size_t __p, size_t __r>
+    class discard_block_engine
+    {
+      static_assert(__r >= 1U && __p >= __r,
+                   "template arguments out of bounds"
+                   " in discard_block_engine");
+
+    public:
+      /** The type of the generated random value. */
+      typedef typename _RandomNumberEngine::result_type result_type;
+
+      // parameter values
+      static const size_t block_size = __p;
+      static const size_t used_block = __r;
+
+      /**
+       * @brief Constructs a default %discard_block_engine engine.
+       *
+       * The underlying engine is default constructed as well.
+       */
+      discard_block_engine()
+      : _M_b(), _M_n(0) { }
+
+      /**
+       * @brief Copy constructs a %discard_block_engine engine.
+       *
+       * Copies an existing base class random number generator.
+       * @param rng An existing (base class) engine object.
+       */
+      explicit
+      discard_block_engine(const _RandomNumberEngine& __rne)
+      : _M_b(__rne), _M_n(0) { }
+
+      /**
+       * @brief Move constructs a %discard_block_engine engine.
+       *
+       * Copies an existing base class random number generator.
+       * @param rng An existing (base class) engine object.
+       */
+      explicit
+      discard_block_engine(_RandomNumberEngine&& __rne)
+      : _M_b(std::move(__rne)), _M_n(0) { }
+
+      /**
+       * @brief Seed constructs a %discard_block_engine engine.
+       *
+       * Constructs the underlying generator engine seeded with @p __s.
+       * @param __s A seed value for the base class engine.
+       */
+      explicit
+      discard_block_engine(result_type __s)
+      : _M_b(__s), _M_n(0) { }
+
+      /**
+       * @brief Generator construct a %discard_block_engine engine.
+       *
+       * @param __q A seed sequence.
+       */
+      explicit
+      discard_block_engine(seed_seq& __q)
+      : _M_b(__q), _M_n(0)
+      { }
+
+      /**
+       * @brief Reseeds the %discard_block_engine object with the default
+       *        seed for the underlying base class generator engine.
+       */
+      void
+      seed()
+      {
+       _M_b.seed();
+       _M_n = 0;
+      }
+
+      /**
+       * @brief Reseeds the %discard_block_engine object with the default
+       *        seed for the underlying base class generator engine.
+       */
+      void
+      seed(result_type __s)
+      {
+       _M_b.seed(__s);
+       _M_n = 0;
+      }
+
+      /**
+       * @brief Reseeds the %discard_block_engine object with the given seed
+       *        sequence.
+       * @param __q A seed generator function.
+       */
+      void
+      seed(seed_seq& __q)
+      {
+        _M_b.seed(__q);
+        _M_n = 0;
+      }
+
+      /**
+       * @brief Gets a const reference to the underlying generator engine
+       *        object.
+       */
+      const _RandomNumberEngine&
+      base() const
+      { return _M_b; }
+
+      /**
+       * @brief Gets the minimum value in the generated random number range.
+       *
+       * @todo This should be constexpr.
+       */
+      result_type
+      min() const
+      { return _M_b.min(); }
+
+      /**
+       * @brief Gets the maximum value in the generated random number range.
+       *
+       * @todo This should be constexpr.
+       */
+      result_type
+      max() const
+      { return _M_b.max(); }
+
+      /**
+       * @brief Discard a sequence of random numbers.
+       *
+       * @todo Look for a faster way to do discard.
+       */
+      void
+      discard(unsigned long long __z)
+      {
+       for (; __z != 0ULL; --__z)
+         (*this)();
+      }
+
+      /**
+       * @brief Gets the next value in the generated random number sequence.
+       */
+      result_type
+      operator()();
+
+      /**
+       * @brief Compares two %discard_block_engine random number generator
+       *        objects of the same type for equality.
+       *
+       * @param __lhs A %discard_block_engine random number generator object.
+       * @param __rhs Another %discard_block_engine random number generator
+       *              object.
+       *
+       * @returns true if the two objects are equal, false otherwise.
+       */
+      friend bool
+      operator==(const discard_block_engine& __lhs,
+                const discard_block_engine& __rhs)
+      { return (__lhs._M_b == __rhs._M_b) && (__lhs._M_n == __rhs._M_n); }
+
+      /**
+       * @brief Inserts the current state of a %discard_block_engine random
+       *        number generator engine @p __x into the output stream
+       *        @p __os.
+       *
+       * @param __os An output stream.
+       * @param __x  A %discard_block_engine random number generator engine.
+       *
+       * @returns The output stream with the state of @p __x inserted or in
+       * an error state.
+       */
+      template<typename _RandomNumberEngine1, size_t __p1, size_t __r1,
+              typename _CharT, typename _Traits>
+       friend std::basic_ostream<_CharT, _Traits>&
+       operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+                  const discard_block_engine<_RandomNumberEngine1,
+                  __p1, __r1>& __x);
+
+      /**
+       * @brief Extracts the current state of a % subtract_with_carry_engine
+       *        random number generator engine @p __x from the input stream
+       *        @p __is.
+       *
+       * @param __is An input stream.
+       * @param __x  A %discard_block_engine random number generator engine.
+       *
+       * @returns The input stream with the state of @p __x extracted or in
+       * an error state.
+       */
+      template<typename _RandomNumberEngine1, size_t __p1, size_t __r1,
+              typename _CharT, typename _Traits>
+       friend std::basic_istream<_CharT, _Traits>&
+       operator>>(std::basic_istream<_CharT, _Traits>& __is,
+                  discard_block_engine<_RandomNumberEngine1,
+                  __p1, __r1>& __x);
+
+    private:
+      _RandomNumberEngine _M_b;
+      size_t _M_n;
+    };
+
+  /**
+   * Produces random numbers by combining random numbers from some base
+   * engine to produce random numbers with a specifies number of bits @p __w.
+   */
+  template<typename _RandomNumberEngine, size_t __w, typename _UIntType>
+    class independent_bits_engine
+    {
+      static_assert(__w > 0U
+                && __w <= static_cast<size_t>(numeric_limits<_UIntType>::digits),
+                   "template arguments out of bounds"
+                   " in independent_bits_engine");
+
+    public:
+      /** The type of the generated random value. */
+      typedef _UIntType result_type;
+
+      /**
+       * @brief Constructs a default %independent_bits_engine engine.
+       *
+       * The underlying engine is default constructed as well.
+       */
+      independent_bits_engine()
+      : _M_b() { }
+
+      /**
+       * @brief Copy constructs a %independent_bits_engine engine.
+       *
+       * Copies an existing base class random number generator.
+       * @param rng An existing (base class) engine object.
+       */
+      explicit
+      independent_bits_engine(const _RandomNumberEngine& __rne)
+      : _M_b(__rne) { }
+
+      /**
+       * @brief Move constructs a %independent_bits_engine engine.
+       *
+       * Copies an existing base class random number generator.
+       * @param rng An existing (base class) engine object.
+       */
+      explicit
+      independent_bits_engine(_RandomNumberEngine&& __rne)
+      : _M_b(std::move(__rne)) { }
+
+      /**
+       * @brief Seed constructs a %independent_bits_engine engine.
+       *
+       * Constructs the underlying generator engine seeded with @p __s.
+       * @param __s A seed value for the base class engine.
+       */
+      explicit
+      independent_bits_engine(result_type __s)
+      : _M_b(__s) { }
+
+      /**
+       * @brief Generator construct a %independent_bits_engine engine.
+       *
+       * @param __q A seed sequence.
+       */
+      explicit
+      independent_bits_engine(seed_seq& __q)
+      : _M_b(__q)
+      { }
+
+      /**
+       * @brief Reseeds the %independent_bits_engine object with the default
+       *        seed for the underlying base class generator engine.
+       */
+      void
+      seed()
+      { _M_b.seed(); }
+
+      /**
+       * @brief Reseeds the %independent_bits_engine object with the default
+       *        seed for the underlying base class generator engine.
+       */
+      void
+      seed(result_type __s)
+      { _M_b.seed(__s); }
+
+      /**
+       * @brief Reseeds the %independent_bits_engine object with the given
+       *        seed sequence.
+       * @param __q A seed generator function.
+       */
+      void
+      seed(seed_seq& __q)
+      { _M_b.seed(__q); }
+
+      /**
+       * @brief Gets a const reference to the underlying generator engine
+       *        object.
+       */
+      const _RandomNumberEngine&
+      base() const
+      { return _M_b; }
+
+      /**
+       * @brief Gets the minimum value in the generated random number range.
+       *
+       * @todo This should be constexpr.
+       */
+      result_type
+      min() const
+      { return 0U; }
+
+      /**
+       * @brief Gets the maximum value in the generated random number range.
+       *
+       * @todo This should be constexpr.
+       */
+      result_type
+      max() const
+      { return __detail::_ShiftMin1<_UIntType, __w>::__value; }
+
+      /**
+       * @brief Discard a sequence of random numbers.
+       *
+       * @todo Look for a faster way to do discard.
+       */
+      void
+      discard(unsigned long long __z)
+      {
+       for (; __z != 0ULL; --__z)
+         (*this)();
+      }
+
+      /**
+       * @brief Gets the next value in the generated random number sequence.
+       */
+      result_type
+      operator()();
+
+      /**
+       * @brief Compares two %independent_bits_engine random number generator
+       * objects of the same type for equality.
+       *
+       * @param __lhs A %independent_bits_engine random number generator
+       *              object.
+       * @param __rhs Another %independent_bits_engine random number generator
+       *              object.
+       *
+       * @returns true if the two objects are equal, false otherwise.
+       */
+      friend bool
+      operator==(const independent_bits_engine& __lhs,
+                const independent_bits_engine& __rhs)
+      { return __lhs._M_b == __rhs._M_b; }
+
+      /**
+       * @brief Extracts the current state of a % subtract_with_carry_engine
+       *        random number generator engine @p __x from the input stream
+       *        @p __is.
+       *
+       * @param __is An input stream.
+       * @param __x  A %independent_bits_engine random number generator
+       *             engine.
+       *
+       * @returns The input stream with the state of @p __x extracted or in
+       *          an error state.
+       */
+      template<typename _CharT, typename _Traits>
+       friend std::basic_istream<_CharT, _Traits>&
+       operator>>(std::basic_istream<_CharT, _Traits>& __is,
+                  independent_bits_engine<_RandomNumberEngine,
+                  __w, _UIntType>& __x)
+       {
+         __is >> __x._M_b;
+         return __is;
+       }
+
+    private:
+      _RandomNumberEngine _M_b;
+    };
+
+  /**
+   * @brief Inserts the current state of a %independent_bits_engine random
+   *        number generator engine @p __x into the output stream @p __os.
+   *
+   * @param __os An output stream.
+   * @param __x  A %independent_bits_engine random number generator engine.
+   *
+   * @returns The output stream with the state of @p __x inserted or in
+   *          an error state.
+   */
+  template<typename _RandomNumberEngine, size_t __w, typename _UIntType,
+          typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const independent_bits_engine<_RandomNumberEngine,
+              __w, _UIntType>& __x)
+    {
+      __os << __x.base();
+      return __os;
+    }
+
+  /**
+   * @brief Produces random numbers by combining random numbers from some
+   * base engine to produce random numbers with a specifies number of bits
+   * @p __w.
+   */
+  template<typename _RandomNumberEngine, size_t __k>
+    class shuffle_order_engine
+    {
+      static_assert(__k >= 1U,
+                   "template arguments out of bounds"
+                   " in shuffle_order_engine");
+
+    public:
+      /** The type of the generated random value. */
+      typedef typename _RandomNumberEngine::result_type result_type;
+
+      static const size_t table_size = __k;
+
+      /**
+       * @brief Constructs a default %shuffle_order_engine engine.
+       *
+       * The underlying engine is default constructed as well.
+       */
+      shuffle_order_engine()
+      : _M_b()
+      { _M_initialize(); }
+
+      /**
+       * @brief Copy constructs a %shuffle_order_engine engine.
+       *
+       * Copies an existing base class random number generator.
+       * @param rng An existing (base class) engine object.
+       */
+      explicit
+      shuffle_order_engine(const _RandomNumberEngine& __rne)
+      : _M_b(__rne)
+      { _M_initialize(); }
+
+      /**
+       * @brief Move constructs a %shuffle_order_engine engine.
+       *
+       * Copies an existing base class random number generator.
+       * @param rng An existing (base class) engine object.
+       */
+      explicit
+      shuffle_order_engine(_RandomNumberEngine&& __rne)
+      : _M_b(std::move(__rne))
+      { _M_initialize(); }
+
+      /**
+       * @brief Seed constructs a %shuffle_order_engine engine.
+       *
+       * Constructs the underlying generator engine seeded with @p __s.
+       * @param __s A seed value for the base class engine.
+       */
+      explicit
+      shuffle_order_engine(result_type __s)
+      : _M_b(__s)
+      { _M_initialize(); }
+
+      /**
+       * @brief Generator construct a %shuffle_order_engine engine.
+       *
+       * @param __q A seed sequence.
+       */
+      explicit
+      shuffle_order_engine(seed_seq& __q)
+      : _M_b(__q)
+      { _M_initialize(); }
+
+      /**
+       * @brief Reseeds the %shuffle_order_engine object with the default seed for
+       *        the underlying base class generator engine.
+       */
+      void
+      seed()
+      {
+       _M_b.seed();
+       _M_initialize();
+      }
+
+      /**
+       * @brief Reseeds the %shuffle_order_engine object with the default seed
+       *        for the underlying base class generator engine.
+       */
+      void
+      seed(result_type __s)
+      {
+       _M_b.seed(__s);
+       _M_initialize();
+      }
+
+      /**
+       * @brief Reseeds the %shuffle_order_engine object with the given seed
+       *        sequence.
+       * @param __q A seed generator function.
+       */
+      void
+      seed(seed_seq& __q)
+      {
+        _M_b.seed(__q);
+        _M_initialize();
+      }
+
+      /**
+       * Gets a const reference to the underlying generator engine object.
+       */
+      const _RandomNumberEngine&
+      base() const
+      { return _M_b; }
+
+      /**
+       * Gets the minimum value in the generated random number range.
+       *
+       * @todo This should be constexpr.
+       */
+      result_type
+      min() const
+      { return _M_b.min(); }
+
+      /**
+       * Gets the maximum value in the generated random number range.
+       *
+       * @todo This should be constexpr.
+       */
+      result_type
+      max() const
+      { return _M_b.max(); }
+
+      /**
+       * Discard a sequence of random numbers.
+       *
+       * @todo Look for a faster way to do discard.
+       */
+      void
+      discard(unsigned long long __z)
+      {
+       for (; __z != 0ULL; --__z)
+         (*this)();
+      }
+
+      /**
+       * Gets the next value in the generated random number sequence.
+       */
+      result_type
+      operator()();
+
+      /**
+       * Compares two %shuffle_order_engine random number generator objects
+       * of the same type for equality.
+       *
+       * @param __lhs A %shuffle_order_engine random number generator object.
+       * @param __rhs Another %shuffle_order_engine random number generator
+       *              object.
+       *
+       * @returns true if the two objects are equal, false otherwise.
+       */
+      friend bool
+      operator==(const shuffle_order_engine& __lhs,
+                const shuffle_order_engine& __rhs)
+      { return __lhs._M_b == __rhs._M_b; }
+
+      /**
+       * @brief Inserts the current state of a %shuffle_order_engine random
+       *        number generator engine @p __x into the output stream
+       @p __os.
+       *
+       * @param __os An output stream.
+       * @param __x  A %shuffle_order_engine random number generator engine.
+       *
+       * @returns The output stream with the state of @p __x inserted or in
+       * an error state.
+       */
+      template<typename _RandomNumberEngine1, size_t __k1,
+              typename _CharT, typename _Traits>
+       friend std::basic_ostream<_CharT, _Traits>&
+       operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+                  const shuffle_order_engine<_RandomNumberEngine1,
+                  __k1>& __x);
+
+      /**
+       * @brief Extracts the current state of a % subtract_with_carry_engine
+       *        random number generator engine @p __x from the input stream
+       *        @p __is.
+       *
+       * @param __is An input stream.
+       * @param __x  A %shuffle_order_engine random number generator engine.
+       *
+       * @returns The input stream with the state of @p __x extracted or in
+       * an error state.
+       */
+      template<typename _RandomNumberEngine1, size_t __k1,
+              typename _CharT, typename _Traits>
+       friend std::basic_istream<_CharT, _Traits>&
+       operator>>(std::basic_istream<_CharT, _Traits>& __is,
+                  shuffle_order_engine<_RandomNumberEngine1,
+                  __k1>& __x);
+
+    private:
+      void _M_initialize()
+      {
+       for (size_t __i = 0; __i < __k; ++__i)
+         _M_v[__i] = _M_b();
+       _M_y = _M_b();
+      }
+
+      _RandomNumberEngine _M_b;
+      result_type _M_v[__k];
+      result_type _M_y;
+    };
+
+  /**
+   * The classic Minimum Standard rand0 of Lewis, Goodman, and Miller.
+   */
+  typedef linear_congruential_engine<uint_fast32_t, 16807UL, 0UL, 2147483647UL>
+  minstd_rand0;
+
+  /**
+   * An alternative LCR (Lehmer Generator function) .
+   */
+  typedef linear_congruential_engine<uint_fast32_t, 48271UL, 0UL, 2147483647UL>
+  minstd_rand;
+
+  /**
+   * The classic Mersenne Twister.
+   *
+   * Reference:
+   * M. Matsumoto and T. Nishimura, "Mersenne Twister: A 623-Dimensionally
+   * Equidistributed Uniform Pseudo-Random Number Generator", ACM Transactions
+   * on Modeling and Computer Simulation, Vol. 8, No. 1, January 1998, pp 3-30.
+   */
+  typedef mersenne_twister_engine<
+    uint_fast32_t,
+    32, 624, 397, 31,
+    0x9908b0dfUL, 11,
+    0xffffffffUL, 7,
+    0x9d2c5680UL, 15,
+    0xefc60000UL, 18, 1812433253UL> mt19937;
+
+  /**
+   * An alternative Mersenne Twister.
+   */
+  typedef mersenne_twister_engine<
+    uint_fast64_t,
+    64, 312, 156, 31,
+    0xb5026f5aa96619e9ULL, 29,
+    0x5555555555555555ULL, 17,
+    0x71d67fffeda60000ULL, 37,
+    0xfff7eee000000000ULL, 43,
+    6364136223846793005ULL> mt19937_64;
+
+  /**
+   * .
+   */
+  typedef subtract_with_carry_engine<uint_fast32_t, 24, 10, 24>
+    ranlux24_base;
+
+  typedef discard_block_engine<ranlux24_base, 223, 23> ranlux24;
+
+  typedef subtract_with_carry_engine<uint_fast64_t, 48, 5, 12>
+    ranlux48_base;
+
+  typedef discard_block_engine<ranlux48_base, 389, 11> ranlux48;
+
+  /**
+   * .
+   */
+  typedef shuffle_order_engine<minstd_rand0, 256> knuth_b;
+
+  /**
+   * .
+   */
+  typedef minstd_rand0 default_random_engine;
+
+  /**
+   * A standard interface to a platform-specific non-deterministic
+   * random number generator (if any are available).
+   */
+  class random_device
+  {
+  public:
+    /** The type of the generated random value. */
+    typedef unsigned int result_type;
+
+    // constructors, destructors and member functions
+
+#ifdef _GLIBCXX_USE_RANDOM_TR1
+
+    explicit
+    random_device(const std::string& __token = "/dev/urandom")
+    {
+      if ((__token != "/dev/urandom" && __token != "/dev/random")
+         || !(_M_file = std::fopen(__token.c_str(), "rb")))
+       std::__throw_runtime_error(__N("random_device::"
+                                      "random_device(const std::string&)"));
+    }
+
+    ~random_device()
+    { std::fclose(_M_file); }
+
+#else
+
+    explicit
+    random_device(const std::string& __token = "mt19937")
+    : _M_mt(_M_strtoul(__token)) { }
+
+  private:
+    static unsigned long
+    _M_strtoul(const std::string& __str)
+    {
+      unsigned long __ret = 5489UL;
+      if (__str != "mt19937")
+       {
+         const char* __nptr = __str.c_str();
+         char* __endptr;
+         __ret = std::strtoul(__nptr, &__endptr, 0);
+         if (*__nptr == '\0' || *__endptr != '\0')
+           std::__throw_runtime_error(__N("random_device::_M_strtoul"
+                                          "(const std::string&)"));
+       }
+      return __ret;
+    }
+
+  public:
+
+#endif
+
+    result_type
+    min() const
+    { return std::numeric_limits<result_type>::min(); }
+
+    result_type
+    max() const
+    { return std::numeric_limits<result_type>::max(); }
+
+    double
+    entropy() const
+    { return 0.0; }
+
+    result_type
+    operator()()
+    {
+#ifdef _GLIBCXX_USE_RANDOM_TR1
+      result_type __ret;
+      std::fread(reinterpret_cast<void*>(&__ret), sizeof(result_type),
+                1, _M_file);
+      return __ret;
+#else
+      return _M_mt();
+#endif
+    }
+
+    // No copy functions.
+    random_device(const random_device&) = delete;
+    void operator=(const random_device&) = delete;
+
+  private:
+
+#ifdef _GLIBCXX_USE_RANDOM_TR1
+    FILE*        _M_file;
+#else
+    mt19937      _M_mt;
+#endif
+  };
+
+  /* @} */ // group std_random_generators
+
+  /**
+   * @addtogroup std_random_distributions Random Number Distributions
+   * @ingroup std_random
+   * @{
+   */
+
+  /**
+   * @addtogroup std_random_distributions_uniform Uniform Distributions
+   * @ingroup std_random_distributions
+   * @{
+   */
+
+  /**
+   * @brief Uniform discrete distribution for random numbers.
+   * A discrete random distribution on the range @f$[min, max]@f$ with equal
+   * probability throughout the range.
+   */
+  template<typename _IntType = int>
+    class uniform_int_distribution
+    {
+      __glibcxx_class_requires(_IntType, _IntegerConcept)
+
+    public:
+      /** The type of the range of the distribution. */
+      typedef _IntType result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+       typedef uniform_int_distribution<_IntType> distribution_type;
+
+       explicit
+       param_type(_IntType __a = 0, _IntType __b = 9)
+       : _M_a(__a), _M_b(__b)
+       {
+         _GLIBCXX_DEBUG_ASSERT(_M_a <= _M_b);
+       }
+
+       result_type
+       a() const
+       { return _M_a; }
+
+       result_type
+       b() const
+       { return _M_b; }
+
+       friend bool
+       operator==(const param_type& __p1, const param_type& __p2)
+       { return (__p1._M_a == __p2._M_a) && (__p1._M_b == __p2._M_b); }
+
+      private:
+       _IntType _M_a;
+       _IntType _M_b;
+      };
+
+    public:
+      /**
+       * @brief Constructs a uniform distribution object.
+       */
+      explicit
+      uniform_int_distribution(_IntType __a = 0, _IntType __b = 9)
+      : _M_param(__a, __b)
+      { }
+
+      explicit
+      uniform_int_distribution(const param_type& __p)
+      : _M_param(__p)
+      { }
+
+      /**
+       * @brief Resets the distribution state.
+       *
+       * Does nothing for the uniform integer distribution.
+       */
+      void
+      reset() { }
+
+      result_type
+      a() const
+      { return _M_param.a(); }
+
+      result_type
+      b() const
+      { return _M_param.b(); }
+
+      /**
+       * @brief Returns the inclusive lower bound of the distribution range.
+       */
+      result_type
+      min() const
+      { return this->a(); }
+
+      /**
+       * @brief Returns the inclusive upper bound of the distribution range.
+       */
+      result_type
+      max() const
+      { return this->b(); }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * Gets a uniformly distributed random number in the range
+       * @f$(min, max)@f$.
+       */
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng)
+       {
+         typedef typename _UniformRandomNumberGenerator::result_type
+           _UResult_type;
+         return _M_call(__urng, this->a(), this->b(),
+                        typename is_integral<_UResult_type>::type());
+       }
+
+      /**
+       * Gets a uniform random number in the range @f$[0, n)@f$.
+       *
+       * This function is aimed at use with std::random_shuffle.
+       */
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng,
+                  const param_type& __p)
+       {
+         typedef typename _UniformRandomNumberGenerator::result_type
+           _UResult_type;
+         return _M_call(__urng, __p.a(), __p.b(),
+                        typename is_integral<_UResult_type>::type());
+       }
+
+    private:
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       _M_call(_UniformRandomNumberGenerator& __urng,
+               result_type __min, result_type __max, true_type);
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       _M_call(_UniformRandomNumberGenerator& __urng,
+               result_type __min, result_type __max, false_type)
+       {
+         return result_type((__urng() - __urng.min())
+                            / (__urng.max() - __urng.min())
+                            * (__max - __min + 1)) + __min;
+       }
+
+      param_type _M_param;
+    };
+
+  /**
+   * @brief Return true if two uniform integer distributions have
+   *        the same parameters.
+   */
+  template<typename _IntType>
+    bool
+    operator==(const uniform_int_distribution<_IntType>& __d1,
+              const uniform_int_distribution<_IntType>& __d2)
+    { return __d1.param() == __d2.param(); }
+
+  /**
+   * @brief Inserts a %uniform_int_distribution random number
+   *        distribution @p __x into the output stream @p os.
+   *
+   * @param __os An output stream.
+   * @param __x  A %uniform_int_distribution random number distribution.
+   *
+   * @returns The output stream with the state of @p __x inserted or in
+   * an error state.
+   */
+  template<typename _IntType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const uniform_int_distribution<_IntType>& __x);
+
+  /**
+   * @brief Extracts a %uniform_int_distribution random number distribution
+   * @p __x from the input stream @p __is.
+   *
+   * @param __is An input stream.
+   * @param __x  A %uniform_int_distribution random number generator engine.
+   *
+   * @returns The input stream with @p __x extracted or in an error state.
+   */
+  template<typename _IntType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              uniform_int_distribution<_IntType>& __x);
+
+
+  /**
+   * @brief Uniform continuous distribution for random numbers.
+   *
+   * A continuous random distribution on the range [min, max) with equal
+   * probability throughout the range.  The URNG should be real-valued and
+   * deliver number in the range [0, 1).
+   */
+  template<typename _RealType = double>
+    class uniform_real_distribution
+    {
+    public:
+      /** The type of the range of the distribution. */
+      typedef _RealType result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+       typedef uniform_real_distribution<_RealType> distribution_type;
+
+       explicit
+       param_type(_RealType __a = _RealType(0),
+                  _RealType __b = _RealType(1))
+       : _M_a(__a), _M_b(__b)
+       {
+         _GLIBCXX_DEBUG_ASSERT(_M_a <= _M_b);
+       }
+
+       result_type
+       a() const
+       { return _M_a; }
+
+       result_type
+       b() const
+       { return _M_b; }
+
+       friend bool
+       operator==(const param_type& __p1, const param_type& __p2)
+       { return (__p1._M_a == __p2._M_a) && (__p1._M_b == __p2._M_b); }
+
+      private:
+       _RealType _M_a;
+       _RealType _M_b;
+      };
+
+    public:
+      /**
+       * @brief Constructs a uniform_real_distribution object.
+       *
+       * @param __min [IN]  The lower bound of the distribution.
+       * @param __max [IN]  The upper bound of the distribution.
+       */
+      explicit
+      uniform_real_distribution(_RealType __a = _RealType(0),
+                               _RealType __b = _RealType(1))
+      : _M_param(__a, __b)
+      { }
+
+      explicit
+      uniform_real_distribution(const param_type& __p)
+      : _M_param(__p)
+      { }
+
+      /**
+       * @brief Resets the distribution state.
+       *
+       * Does nothing for the uniform real distribution.
+       */
+      void
+      reset() { }
+
+      result_type
+      a() const
+      { return _M_param.a(); }
+
+      result_type
+      b() const
+      { return _M_param.b(); }
+
+      /**
+       * @brief Returns the inclusive lower bound of the distribution range.
+       */
+      result_type
+      min() const
+      { return this->a(); }
+
+      /**
+       * @brief Returns the inclusive upper bound of the distribution range.
+       */
+      result_type
+      max() const
+      { return this->b(); }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng)
+       {
+         __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
+           __aurng(__urng);
+         return (__aurng() * (this->b() - this->a())) + this->a();
+       }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng,
+                  const param_type& __p)
+       {
+         __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
+           __aurng(__urng);
+         return (__aurng() * (__p.b() - __p.a())) + __p.a();
+       }
+
+    private:
+      param_type _M_param;
+    };
+
+  /**
+   * @brief Return true if two uniform real distributions have
+   *        the same parameters.
+   */
+  template<typename _IntType>
+    bool
+    operator==(const uniform_real_distribution<_IntType>& __d1,
+              const uniform_real_distribution<_IntType>& __d2)
+    { return __d1.param() == __d2.param(); }
+
+  /**
+   * @brief Inserts a %uniform_real_distribution random number
+   *        distribution @p __x into the output stream @p __os.
+   *
+   * @param __os An output stream.
+   * @param __x  A %uniform_real_distribution random number distribution.
+   *
+   * @returns The output stream with the state of @p __x inserted or in
+   *          an error state.
+   */
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const uniform_real_distribution<_RealType>& __x);
+
+  /**
+   * @brief Extracts a %uniform_real_distribution random number distribution
+   * @p __x from the input stream @p __is.
+   *
+   * @param __is An input stream.
+   * @param __x  A %uniform_real_distribution random number generator engine.
+   *
+   * @returns The input stream with @p __x extracted or in an error state.
+   */
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              uniform_real_distribution<_RealType>& __x);
+
+  /* @} */ // group std_random_distributions_uniform
+
+  /**
+   * @addtogroup std_random_distributions_normal Normal Distributions
+   * @ingroup std_random_distributions
+   * @{
+   */
+
+  /**
+   * @brief A normal continuous distribution for random numbers.
+   *
+   * The formula for the normal probability density function is
+   * @f$ p(x|\mu,\sigma) = \frac{1}{\sigma \sqrt{2 \pi}}
+   *            e^{- \frac{{x - \mu}^ {2}}{2 \sigma ^ {2}} } @f$.
+   */
+  template<typename _RealType = double>
+    class normal_distribution
+    {
+    public:
+      /** The type of the range of the distribution. */
+      typedef _RealType result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+       typedef normal_distribution<_RealType> distribution_type;
+
+       explicit
+       param_type(_RealType __mean = _RealType(0),
+                  _RealType __stddev = _RealType(1))
+       : _M_mean(__mean), _M_stddev(__stddev)
+       {
+         _GLIBCXX_DEBUG_ASSERT(_M_stddev > _RealType(0));
+       }
+
+       _RealType
+       mean() const
+       { return _M_mean; }
+
+       _RealType
+       stddev() const
+       { return _M_stddev; }
+
+       friend bool
+       operator==(const param_type& __p1, const param_type& __p2)
+       { return (__p1._M_mean == __p2._M_mean)
+             && (__p1._M_stddev == __p2._M_stddev); }
+
+      private:
+       _RealType _M_mean;
+       _RealType _M_stddev;
+      };
+
+    public:
+      /**
+       * Constructs a normal distribution with parameters @f$ mean @f$ and
+       * standard deviation.
+       */
+      explicit
+      normal_distribution(result_type __mean = result_type(0),
+                         result_type __stddev = result_type(1))
+      : _M_param(__mean, __stddev), _M_saved_available(false)
+      { }
+
+      explicit
+      normal_distribution(const param_type& __p)
+      : _M_param(__p), _M_saved_available(false)
+      { }
+
+      /**
+       * @brief Resets the distribution state.
+       */
+      void
+      reset()
+      { _M_saved_available = false; }
+
+      /**
+       * @brief Returns the mean of the distribution.
+       */
+      _RealType
+      mean() const
+      { return _M_param.mean(); }
+
+      /**
+       * @brief Returns the standard deviation of the distribution.
+       */
+      _RealType
+      stddev() const
+      { return _M_param.stddev(); }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the greatest lower bound value of the distribution.
+       */
+      result_type
+      min() const
+      { return std::numeric_limits<result_type>::min(); }
+
+      /**
+       * @brief Returns the least upper bound value of the distribution.
+       */
+      result_type
+      max() const
+      { return std::numeric_limits<result_type>::max(); }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng)
+       { return this->operator()(__urng, this->param()); }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng,
+                  const param_type& __p);
+
+      /**
+       * @brief Return true if two normal distributions have
+       *        the same parameters.
+       */
+      template<typename _RealType1>
+       friend bool
+       operator==(const normal_distribution<_RealType1>& __d1,
+                  const normal_distribution<_RealType1>& __d2);
+
+      /**
+       * @brief Inserts a %normal_distribution random number distribution
+       * @p __x into the output stream @p __os.
+       *
+       * @param __os An output stream.
+       * @param __x  A %normal_distribution random number distribution.
+       *
+       * @returns The output stream with the state of @p __x inserted or in
+       * an error state.
+       */
+      template<typename _RealType1, typename _CharT, typename _Traits>
+       friend std::basic_ostream<_CharT, _Traits>&
+       operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+                  const normal_distribution<_RealType1>& __x);
+
+      /**
+       * @brief Extracts a %normal_distribution random number distribution
+       * @p __x from the input stream @p __is.
+       *
+       * @param __is An input stream.
+       * @param __x  A %normal_distribution random number generator engine.
+       *
+       * @returns The input stream with @p __x extracted or in an error
+       *          state.
+       */
+      template<typename _RealType1, typename _CharT, typename _Traits>
+       friend std::basic_istream<_CharT, _Traits>&
+       operator>>(std::basic_istream<_CharT, _Traits>& __is,
+                  normal_distribution<_RealType1>& __x);
+
+    private:
+      param_type  _M_param;
+      result_type _M_saved;
+      bool        _M_saved_available;
+    };
+
+
+  /**
+   * @brief A lognormal_distribution random number distribution.
+   *
+   * The formula for the normal probability mass function is
+   * @f$ p(x|m,s) = \frac{1}{sx\sqrt{2\pi}}
+   *             \exp{-\frac{(\ln{x} - m)^2}{2s^2}} @f$
+   */
+  template<typename _RealType = double>
+    class lognormal_distribution
+    {
+    public:
+      /** The type of the range of the distribution. */
+      typedef _RealType result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+       typedef lognormal_distribution<_RealType> distribution_type;
+
+       explicit
+       param_type(_RealType __m = _RealType(0),
+                  _RealType __s = _RealType(1))
+       : _M_m(__m), _M_s(__s)
+       { }
+
+       _RealType
+       m() const
+       { return _M_m; }
+
+       _RealType
+       s() const
+       { return _M_s; }
+
+       friend bool
+       operator==(const param_type& __p1, const param_type& __p2)
+       { return (__p1._M_m == __p2._M_m) && (__p1._M_s == __p2._M_s); }
+
+      private:
+       _RealType _M_m;
+       _RealType _M_s;
+      };
+
+      explicit
+      lognormal_distribution(_RealType __m = _RealType(0),
+                            _RealType __s = _RealType(1))
+      : _M_param(__m, __s)
+      { }
+
+      explicit
+      lognormal_distribution(const param_type& __p)
+      : _M_param(__p)
+      { }
+
+      /**
+       * Resets the distribution state.
+       */
+      void
+      reset()
+      { }
+
+      /**
+       *
+       */
+      _RealType
+      m() const
+      { return _M_param.m(); }
+
+      _RealType
+      s() const
+      { return _M_param.s(); }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the greatest lower bound value of the distribution.
+       */
+      result_type
+      min() const
+      { return result_type(0); }
+
+      /**
+       * @brief Returns the least upper bound value of the distribution.
+       */
+      result_type
+      max() const
+      { return std::numeric_limits<result_type>::max(); }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng)
+       { return this->operator()(__urng, this->param()); }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng,
+                  const param_type& __p);
+
+    private:
+      param_type _M_param;
+    };
+
+  /**
+   * @brief Return true if two lognormal distributions have
+   *        the same parameters.
+   */
+  template<typename _RealType>
+    bool
+    operator==(const lognormal_distribution<_RealType>& __d1,
+              const lognormal_distribution<_RealType>& __d2)
+    { return __d1.param() == __d2.param(); }
+
+  /**
+   * @brief Inserts a %lognormal_distribution random number distribution
+   * @p __x into the output stream @p __os.
+   *
+   * @param __os An output stream.
+   * @param __x  A %lognormal_distribution random number distribution.
+   *
+   * @returns The output stream with the state of @p __x inserted or in
+   * an error state.
+   */
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const lognormal_distribution<_RealType>& __x);
+
+  /**
+   * @brief Extracts a %lognormal_distribution random number distribution
+   * @p __x from the input stream @p __is.
+   *
+   * @param __is An input stream.
+   * @param __x A %lognormal_distribution random number
+   *            generator engine.
+   *
+   * @returns The input stream with @p __x extracted or in an error state.
+   */
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              lognormal_distribution<_RealType>& __x);
+
+
+  /**
+   * @brief A chi_squared_distribution random number distribution.
+   *
+   * The formula for the normal probability mass function is
+   * @f$ p(x|n) = \frac{x^{(n/2) - 1}e^{-x/2}}{\Gamma(n/2) 2^{n/2}} @f$
+   */
+  template<typename _RealType = double>
+    class chi_squared_distribution
+    {
+    public:
+      /** The type of the range of the distribution. */
+      typedef _RealType result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+       typedef chi_squared_distribution<_RealType> distribution_type;
+
+       explicit
+       param_type(_RealType __n = _RealType(1))
+       : _M_n(__n)
+       { }
+
+       _RealType
+       n() const
+       { return _M_n; }
+
+       friend bool
+       operator==(const param_type& __p1, const param_type& __p2)
+       { return __p1._M_n == __p2._M_n; }
+
+      private:
+       _RealType _M_n;
+      };
+
+      explicit
+      chi_squared_distribution(_RealType __n = _RealType(1))
+      : _M_param(__n)
+      { }
+
+      explicit
+      chi_squared_distribution(const param_type& __p)
+      : _M_param(__p)
+      { }
+
+      /**
+       * @brief Resets the distribution state.
+       */
+      void
+      reset()
+      { }
+
+      /**
+       *
+       */
+      _RealType
+      n() const
+      { return _M_param.n(); }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the greatest lower bound value of the distribution.
+       */
+      result_type
+      min() const
+      { return result_type(0); }
+
+      /**
+       * @brief Returns the least upper bound value of the distribution.
+       */
+      result_type
+      max() const
+      { return std::numeric_limits<result_type>::max(); }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng)
+       { return this->operator()(__urng, this->param()); }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng,
+                  const param_type& __p);
+
+    private:
+      param_type _M_param;
+    };
+
+  /**
+   * @brief Return true if two Chi-squared distributions have
+   *        the same parameters.
+   */
+  template<typename _RealType>
+    bool
+    operator==(const chi_squared_distribution<_RealType>& __d1,
+              const chi_squared_distribution<_RealType>& __d2)
+    { return __d1.param() == __d2.param(); }
+
+  /**
+   * @brief Inserts a %chi_squared_distribution random number distribution
+   * @p __x into the output stream @p __os.
+   *
+   * @param __os An output stream.
+   * @param __x  A %chi_squared_distribution random number distribution.
+   *
+   * @returns The output stream with the state of @p __x inserted or in
+   * an error state.
+   */
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const chi_squared_distribution<_RealType>& __x);
+
+  /**
+   * @brief Extracts a %chi_squared_distribution random number distribution
+   * @p __x from the input stream @p __is.
+   *
+   * @param __is An input stream.
+   * @param __x A %chi_squared_distribution random number
+   *            generator engine.
+   *
+   * @returns The input stream with @p __x extracted or in an error state.
+   */
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              chi_squared_distribution<_RealType>& __x);
+
+
+  /**
+   * @brief A cauchy_distribution random number distribution.
+   *
+   * The formula for the normal probability mass function is
+   * @f$ p(x|a,b) = \( \pi b \( 1 + \( \frac{x-a}{b} \)^2 \) \)^{-1} @f$
+   */
+  template<typename _RealType = double>
+    class cauchy_distribution
+    {
+    public:
+      /** The type of the range of the distribution. */
+      typedef _RealType result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+       typedef cauchy_distribution<_RealType> distribution_type;
+
+       explicit
+       param_type(_RealType __a = _RealType(0),
+                  _RealType __b = _RealType(1))
+       : _M_a(__a), _M_b(__b)
+       { }
+
+       _RealType
+       a() const
+       { return _M_a; }
+
+       _RealType
+       b() const
+       { return _M_b; }
+
+       friend bool
+       operator==(const param_type& __p1, const param_type& __p2)
+       { return (__p1._M_a == __p2._M_a) && (__p1._M_b == __p2._M_b); }
+
+      private:
+       _RealType _M_a;
+       _RealType _M_b;
+      };
+
+      explicit
+      cauchy_distribution(_RealType __a = _RealType(0),
+                         _RealType __b = _RealType(1))
+      : _M_param(__a, __b)
+      { }
+
+      explicit
+      cauchy_distribution(const param_type& __p)
+      : _M_param(__p)
+      { }
+
+      /**
+       * @brief Resets the distribution state.
+       */
+      void
+      reset()
+      { }
+
+      /**
+       *
+       */
+      _RealType
+      a() const
+      { return _M_param.a(); }
+
+      _RealType
+      b() const
+      { return _M_param.b(); }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the greatest lower bound value of the distribution.
+       */
+      result_type
+      min() const
+      { return std::numeric_limits<result_type>::min(); }
+
+      /**
+       * @brief Returns the least upper bound value of the distribution.
+       */
+      result_type
+      max() const
+      { return std::numeric_limits<result_type>::max(); }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng)
+       { return this->operator()(__urng, this->param()); }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng,
+                  const param_type& __p);
+
+    private:
+      param_type _M_param;
+    };
+
+  /**
+   * @brief Return true if two Cauchy distributions have
+   *        the same parameters.
+   */
+  template<typename _RealType>
+    bool
+    operator==(const cauchy_distribution<_RealType>& __d1,
+              const cauchy_distribution<_RealType>& __d2)
+    { return __d1.param() == __d2.param(); }
+
+  /**
+   * @brief Inserts a %cauchy_distribution random number distribution
+   * @p __x into the output stream @p __os.
+   *
+   * @param __os An output stream.
+   * @param __x  A %cauchy_distribution random number distribution.
+   *
+   * @returns The output stream with the state of @p __x inserted or in
+   * an error state.
+   */
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const cauchy_distribution<_RealType>& __x);
+
+  /**
+   * @brief Extracts a %cauchy_distribution random number distribution
+   * @p __x from the input stream @p __is.
+   *
+   * @param __is An input stream.
+   * @param __x A %cauchy_distribution random number
+   *            generator engine.
+   *
+   * @returns The input stream with @p __x extracted or in an error state.
+   */
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              cauchy_distribution<_RealType>& __x);
+
+
+  /**
+   * @brief A fisher_f_distribution random number distribution.
+   *
+   * The formula for the normal probability mass function is
+   * @f$ p(x|m,n) = \frac{\Gamma((m+n)/2)}{\Gamma(m/2)\Gamma(n/2)}
+   *                \(\frac{m}{n}\)^{m/2} x^{(m/2)-1}
+   *                \( 1 + \frac{mx}{n} \)^{-(m+n)/2} @f$
+   */
+  template<typename _RealType = double>
+    class fisher_f_distribution
+    {
+    public:
+      /** The type of the range of the distribution. */
+      typedef _RealType result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+       typedef fisher_f_distribution<_RealType> distribution_type;
+
+       explicit
+       param_type(_RealType __m = _RealType(1),
+                  _RealType __n = _RealType(1))
+       : _M_m(__m), _M_n(__n)
+       { }
+
+       _RealType
+       m() const
+       { return _M_m; }
+
+       _RealType
+       n() const
+       { return _M_n; }
+
+       friend bool
+       operator==(const param_type& __p1, const param_type& __p2)
+       { return (__p1._M_m == __p2._M_m) && (__p1._M_n == __p2._M_n); }
+
+      private:
+       _RealType _M_m;
+       _RealType _M_n;
+      };
+
+      explicit
+      fisher_f_distribution(_RealType __m = _RealType(1),
+                           _RealType __n = _RealType(1))
+      : _M_param(__m, __n)
+      { }
+
+      explicit
+      fisher_f_distribution(const param_type& __p)
+      : _M_param(__p)
+      { }
+
+      /**
+       * @brief Resets the distribution state.
+       */
+      void
+      reset()
+      { }
+
+      /**
+       *
+       */
+      _RealType
+      m() const
+      { return _M_param.m(); }
+
+      _RealType
+      n() const
+      { return _M_param.n(); }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the greatest lower bound value of the distribution.
+       */
+      result_type
+      min() const
+      { return result_type(0); }
+
+      /**
+       * @brief Returns the least upper bound value of the distribution.
+       */
+      result_type
+      max() const
+      { return std::numeric_limits<result_type>::max(); }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng)
+       { return this->operator()(__urng, this->param()); }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng,
+                  const param_type& __p);
+
+    private:
+      param_type _M_param;
+    };
+
+  /**
+   * @brief Return true if two Fisher f distributions have
+   *        the same parameters.
+   */
+  template<typename _RealType>
+    bool
+    operator==(const fisher_f_distribution<_RealType>& __d1,
+              const fisher_f_distribution<_RealType>& __d2)
+    { return __d1.param() == __d2.param(); }
+
+  /**
+   * @brief Inserts a %fisher_f_distribution random number distribution
+   * @p __x into the output stream @p __os.
+   *
+   * @param __os An output stream.
+   * @param __x  A %fisher_f_distribution random number distribution.
+   *
+   * @returns The output stream with the state of @p __x inserted or in
+   * an error state.
+   */
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const fisher_f_distribution<_RealType>& __x);
+
+  /**
+   * @brief Extracts a %fisher_f_distribution random number distribution
+   * @p __x from the input stream @p __is.
+   *
+   * @param __is An input stream.
+   * @param __x A %fisher_f_distribution random number
+   *            generator engine.
+   *
+   * @returns The input stream with @p __x extracted or in an error state.
+   */
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              fisher_f_distribution<_RealType>& __x);
+
+
+  /**
+   * @brief A student_t_distribution random number distribution.
+   *
+   * The formula for the normal probability mass function is
+   * @f$ p(x|n) = \frac{1}{\sqrt(n\pi)} \frac{\Gamma((n+1)/2)}{\Gamma(n/2)}
+   *              \( 1 + \frac{x^2}{n} \) ^{-(n+1)/2} @f$
+   */
+  template<typename _RealType = double>
+    class student_t_distribution
+    {
+    public:
+      /** The type of the range of the distribution. */
+      typedef _RealType result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+       typedef student_t_distribution<_RealType> distribution_type;
+
+       explicit
+       param_type(_RealType __n = _RealType(1))
+       : _M_n(__n)
+       { }
+
+       _RealType
+       n() const
+       { return _M_n; }
+
+       friend bool
+       operator==(const param_type& __p1, const param_type& __p2)
+       { return __p1._M_n == __p2._M_n; }
+
+      private:
+       _RealType _M_n;
+      };
+
+      explicit
+      student_t_distribution(_RealType __n = _RealType(1))
+      : _M_param(__n)
+      { }
+
+      explicit
+      student_t_distribution(const param_type& __p)
+      : _M_param(__p)
+      { }
+
+      /**
+       * @brief Resets the distribution state.
+       */
+      void
+      reset()
+      { }
+
+      /**
+       *
+       */
+      _RealType
+      n() const
+      { return _M_param.n(); }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the greatest lower bound value of the distribution.
+       */
+      result_type
+      min() const
+      { return std::numeric_limits<result_type>::min(); }
+
+      /**
+       * @brief Returns the least upper bound value of the distribution.
+       */
+      result_type
+      max() const
+      { return std::numeric_limits<result_type>::max(); }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng)
+       { return this->operator()(__urng, this->param()); }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng,
+                  const param_type& __p);
+
+    private:
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       _M_gaussian(_UniformRandomNumberGenerator& __urng,
+                   const result_type __sigma);
+
+      param_type _M_param;
+    };
+
+  /**
+   * @brief Return true if two Student t distributions have
+   *        the same parameters.
+   */
+  template<typename _RealType>
+    bool
+    operator==(const student_t_distribution<_RealType>& __d1,
+              const student_t_distribution<_RealType>& __d2)
+    { return __d1.param() == __d2.param(); }
+
+  /**
+   * @brief Inserts a %student_t_distribution random number distribution
+   * @p __x into the output stream @p __os.
+   *
+   * @param __os An output stream.
+   * @param __x  A %student_t_distribution random number distribution.
+   *
+   * @returns The output stream with the state of @p __x inserted or in
+   * an error state.
+   */
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const student_t_distribution<_RealType>& __x);
+
+  /**
+   * @brief Extracts a %student_t_distribution random number distribution
+   * @p __x from the input stream @p __is.
+   *
+   * @param __is An input stream.
+   * @param __x A %student_t_distribution random number
+   *            generator engine.
+   *
+   * @returns The input stream with @p __x extracted or in an error state.
+   */
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              student_t_distribution<_RealType>& __x);
+
+  /* @} */ // group std_random_distributions_normal
+
+  /**
+   * @addtogroup std_random_distributions_bernoulli Bernoulli Distributions
+   * @ingroup std_random_distributions
+   * @{
+   */
+
+  /**
+   * @brief A Bernoulli random number distribution.
+   *
+   * Generates a sequence of true and false values with likelihood @f$ p @f$
+   * that true will come up and @f$ (1 - p) @f$ that false will appear.
+   */
+  class bernoulli_distribution
+  {
+  public:
+    /** The type of the range of the distribution. */
+    typedef bool result_type;
+    /** Parameter type. */
+    struct param_type
+    {
+      typedef bernoulli_distribution distribution_type;
+
+      explicit
+      param_type(double __p = 0.5)
+      : _M_p(__p)
+      {
+       _GLIBCXX_DEBUG_ASSERT((_M_p >= 0.0) && (_M_p <= 1.0));
+      }
+
+      double
+      p() const
+      { return _M_p; }
+
+      friend bool
+      operator==(const param_type& __p1, const param_type& __p2)
+      { return __p1._M_p == __p2._M_p; }
+
+    private:
+      double _M_p;
+    };
+
+  public:
+    /**
+     * @brief Constructs a Bernoulli distribution with likelihood @p p.
+     *
+     * @param __p  [IN]  The likelihood of a true result being returned.
+     *                   Must be in the interval @f$ [0, 1] @f$.
+     */
+    explicit
+    bernoulli_distribution(double __p = 0.5)
+    : _M_param(__p)
+    { }
+
+    explicit
+    bernoulli_distribution(const param_type& __p)
+    : _M_param(__p)
+    { }
+
+    /**
+     * @brief Resets the distribution state.
+     *
+     * Does nothing for a Bernoulli distribution.
+     */
+    void
+    reset() { }
+
+    /**
+     * @brief Returns the @p p parameter of the distribution.
+     */
+    double
+    p() const
+    { return _M_param.p(); }
+
+    /**
+     * @brief Returns the parameter set of the distribution.
+     */
+    param_type
+    param() const
+    { return _M_param; }
+
+    /**
+     * @brief Sets the parameter set of the distribution.
+     * @param __param The new parameter set of the distribution.
+     */
+    void
+    param(const param_type& __param)
+    { _M_param = __param; }
+
+    /**
+     * @brief Returns the greatest lower bound value of the distribution.
+     */
+    result_type
+    min() const
+    { return std::numeric_limits<result_type>::min(); }
+
+    /**
+     * @brief Returns the least upper bound value of the distribution.
+     */
+    result_type
+    max() const
+    { return std::numeric_limits<result_type>::max(); }
+
+    /**
+     * @brief Returns the next value in the Bernoullian sequence.
+     */
+    template<typename _UniformRandomNumberGenerator>
+      result_type
+      operator()(_UniformRandomNumberGenerator& __urng)
+      {
+       __detail::_Adaptor<_UniformRandomNumberGenerator, double>
+         __aurng(__urng);
+       if ((__aurng() - __aurng.min())
+            < this->p() * (__aurng.max() - __aurng.min()))
+         return true;
+       return false;
+      }
+
+    template<typename _UniformRandomNumberGenerator>
+      result_type
+      operator()(_UniformRandomNumberGenerator& __urng,
+                const param_type& __p)
+      {
+       __detail::_Adaptor<_UniformRandomNumberGenerator, double>
+         __aurng(__urng);
+       if ((__aurng() - __aurng.min())
+            < __p.p() * (__aurng.max() - __aurng.min()))
+         return true;
+       return false;
+      }
+
+  private:
+    param_type _M_param;
+  };
+
+  /**
+   * @brief Return true if two Bernoulli distributions have
+   *        the same parameters.
+   */
+  bool
+  operator==(const bernoulli_distribution& __d1,
+            const bernoulli_distribution& __d2)
+  { return __d1.param() == __d2.param(); }
+
+  /**
+   * @brief Inserts a %bernoulli_distribution random number distribution
+   * @p __x into the output stream @p __os.
+   *
+   * @param __os An output stream.
+   * @param __x  A %bernoulli_distribution random number distribution.
+   *
+   * @returns The output stream with the state of @p __x inserted or in
+   * an error state.
+   */
+  template<typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const bernoulli_distribution& __x);
+
+  /**
+   * @brief Extracts a %bernoulli_distribution random number distribution
+   * @p __x from the input stream @p __is.
+   *
+   * @param __is An input stream.
+   * @param __x  A %bernoulli_distribution random number generator engine.
+   *
+   * @returns The input stream with @p __x extracted or in an error state.
+   */
+  template<typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              bernoulli_distribution& __x)
+    {
+      double __p;
+      __is >> __p;
+      __x.param(bernoulli_distribution::param_type(__p));
+      return __is;
+    }
+
+
+  /**
+   * @brief A discrete binomial random number distribution.
+   *
+   * The formula for the binomial probability density function is
+   * @f$ p(i|t,p) = \binom{n}{i} p^i (1 - p)^{t - i} @f$ where @f$ t @f$
+   * and @f$ p @f$ are the parameters of the distribution.
+   */
+  template<typename _IntType = int>
+    class binomial_distribution
+    {
+      __glibcxx_class_requires(_IntType, _IntegerConcept)
+
+    public:
+      /** The type of the range of the distribution. */
+      typedef _IntType result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+       typedef binomial_distribution<_IntType> distribution_type;
+       friend class binomial_distribution<_IntType>;
+
+       explicit
+       param_type(_IntType __t = _IntType(1), double __p = 0.5)
+       : _M_t(__t), _M_p(__p)
+       {
+         _GLIBCXX_DEBUG_ASSERT((_M_t >= _IntType(0))
+                            && (_M_p >= 0.0)
+                            && (_M_p <= 1.0));
+         _M_initialize();
+       }
+
+       _IntType
+       t() const
+       { return _M_t; }
+
+       double
+       p() const
+       { return _M_p; }
+
+       friend bool
+       operator==(const param_type& __p1, const param_type& __p2)
+       { return (__p1._M_t == __p2._M_t) && (__p1._M_p == __p2._M_p); }
+
+      private:
+       void
+       _M_initialize();
+
+       _IntType _M_t;
+       double _M_p;
+
+       double _M_q;
+#if _GLIBCXX_USE_C99_MATH_TR1
+       double _M_d1, _M_d2, _M_s1, _M_s2, _M_c,
+              _M_a1, _M_a123, _M_s, _M_lf, _M_lp1p;
+#endif
+       bool   _M_easy;
+      };
+
+      // constructors and member function
+      explicit
+      binomial_distribution(_IntType __t = _IntType(1),
+                           double __p = 0.5)
+      : _M_param(__t, __p), _M_nd()
+      { }
+
+      explicit
+      binomial_distribution(const param_type& __p)
+      : _M_param(__p), _M_nd()
+      { }
+
+      /**
+       * @brief Resets the distribution state.
+       */
+      void
+      reset()
+      { _M_nd.reset(); }
+
+      /**
+       * @brief Returns the distribution @p t parameter.
+       */
+      _IntType
+      t() const
+      { return _M_param.t(); }
+
+      /**
+       * @brief Returns the distribution @p p parameter.
+       */
+      double
+      p() const
+      { return _M_param.p(); }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the greatest lower bound value of the distribution.
+       */
+      result_type
+      min() const
+      { return 0; }
+
+      /**
+       * @brief Returns the least upper bound value of the distribution.
+       */
+      result_type
+      max() const
+      { return _M_param.t(); }
+
+      /**
+       * @brief Return true if two binomial distributions have
+       *        the same parameters.
+       */
+      template<typename _IntType1>
+       friend bool
+       operator==(const binomial_distribution<_IntType1>& __d1,
+                  const binomial_distribution<_IntType1>& __d2)
+       { return (__d1.param() == __d2.param())
+             && (__d1._M_nd == __d2._M_nd); }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng)
+       { return this->operator()(__urng, this->param()); }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng,
+                  const param_type& __p);
+
+      /**
+       * @brief Inserts a %binomial_distribution random number distribution
+       * @p __x into the output stream @p __os.
+       *
+       * @param __os An output stream.
+       * @param __x  A %binomial_distribution random number distribution.
+       *
+       * @returns The output stream with the state of @p __x inserted or in
+       * an error state.
+       */
+      template<typename _IntType1,
+              typename _CharT, typename _Traits>
+       friend std::basic_ostream<_CharT, _Traits>&
+       operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+                  const binomial_distribution<_IntType1>& __x);
+
+      /**
+       * @brief Extracts a %binomial_distribution random number distribution
+       * @p __x from the input stream @p __is.
+       *
+       * @param __is An input stream.
+       * @param __x  A %binomial_distribution random number generator engine.
+       *
+       * @returns The input stream with @p __x extracted or in an error
+       *          state.
+       */
+      template<typename _IntType1,
+              typename _CharT, typename _Traits>
+       friend std::basic_istream<_CharT, _Traits>&
+       operator>>(std::basic_istream<_CharT, _Traits>& __is,
+                  binomial_distribution<_IntType1>& __x);
+
+    private:
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       _M_waiting(_UniformRandomNumberGenerator& __urng, _IntType __t);
+
+      param_type _M_param;
+
+      // NB: Unused when _GLIBCXX_USE_C99_MATH_TR1 is undefined.
+      normal_distribution<double> _M_nd;
+    };
+
+
+  /**
+   * @brief A discrete geometric random number distribution.
+   *
+   * The formula for the geometric probability density function is
+   * @f$ p(i|p) = (1 - p)p^{i-1} @f$ where @f$ p @f$ is the parameter of the
+   * distribution.
+   */
+  template<typename _IntType = int>
+    class geometric_distribution
+    {
+      __glibcxx_class_requires(_IntType, _IntegerConcept)
+
+    public:
+      /** The type of the range of the distribution. */
+      typedef _IntType  result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+       typedef geometric_distribution<_IntType> distribution_type;
+       friend class geometric_distribution<_IntType>;
+
+       explicit
+       param_type(double __p = 0.5)
+       : _M_p(__p)
+       {
+         _GLIBCXX_DEBUG_ASSERT((_M_p >= 0.0)
+                            && (_M_p <= 1.0));
+         _M_initialize();
+       }
+
+       double
+       p() const
+       { return _M_p; }
+
+       friend bool
+       operator==(const param_type& __p1, const param_type& __p2)
+       { return __p1._M_p == __p2._M_p; }
+
+      private:
+       void
+       _M_initialize()
+       { _M_log_p = std::log(_M_p); }
+
+       double _M_p;
+
+       double _M_log_p;
+      };
+
+      // constructors and member function
+      explicit
+      geometric_distribution(double __p = 0.5)
+      : _M_param(__p)
+      { }
+
+      explicit
+      geometric_distribution(const param_type& __p)
+      : _M_param(__p)
+      { }
+
+      /**
+       * @brief Resets the distribution state.
+       *
+       * Does nothing for the geometric distribution.
+       */
+      void
+      reset() { }
+
+      /**
+       * @brief Returns the distribution parameter @p p.
+       */
+      double
+      p() const
+      { return _M_param.p(); }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the greatest lower bound value of the distribution.
+       */
+      result_type
+      min() const
+      { return 0; }
+
+      /**
+       * @brief Returns the least upper bound value of the distribution.
+       */
+      result_type
+      max() const
+      { return std::numeric_limits<result_type>::max(); }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng)
+       { return this->operator()(__urng, this->param()); }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng,
+                  const param_type& __p);
+
+    private:
+      param_type _M_param;
+    };
+
+  /**
+   * @brief Return true if two geometric distributions have
+   *        the same parameters.
+   */
+  template<typename _IntType>
+    bool
+    operator==(const geometric_distribution<_IntType>& __d1,
+              const geometric_distribution<_IntType>& __d2)
+    { return __d1.param() == __d2.param(); }
+
+  /**
+   * @brief Inserts a %geometric_distribution random number distribution
+   * @p __x into the output stream @p __os.
+   *
+   * @param __os An output stream.
+   * @param __x  A %geometric_distribution random number distribution.
+   *
+   * @returns The output stream with the state of @p __x inserted or in
+   * an error state.
+   */
+  template<typename _IntType,
+          typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const geometric_distribution<_IntType>& __x);
+
+  /**
+   * @brief Extracts a %geometric_distribution random number distribution
+   * @p __x from the input stream @p __is.
+   *
+   * @param __is An input stream.
+   * @param __x  A %geometric_distribution random number generator engine.
+   *
+   * @returns The input stream with @p __x extracted or in an error state.
+   */
+  template<typename _IntType,
+          typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              geometric_distribution<_IntType>& __x);
+
+
+  /**
+   * @brief A negative_binomial_distribution random number distribution.
+   *
+   * The formula for the negative binomial probability mass function is
+   * @f$ p(i) = \binom{n}{i} p^i (1 - p)^{t - i} @f$ where @f$ t @f$
+   * and @f$ p @f$ are the parameters of the distribution.
+   */
+  template<typename _IntType = int>
+    class negative_binomial_distribution
+    {
+      __glibcxx_class_requires(_IntType, _IntegerConcept)
+
+    public:
+      /** The type of the range of the distribution. */
+      typedef _IntType result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+       typedef negative_binomial_distribution<_IntType> distribution_type;
+
+       explicit
+       param_type(_IntType __k = 1, double __p = 0.5)
+       : _M_k(__k), _M_p(__p)
+       { }
+
+       _IntType
+       k() const
+       { return _M_k; }
+
+       double
+       p() const
+       { return _M_p; }
+
+       friend bool
+       operator==(const param_type& __p1, const param_type& __p2)
+       { return (__p1._M_k == __p2._M_k) && (__p1._M_p == __p2._M_p); }
+
+      private:
+       _IntType _M_k;
+       double _M_p;
+      };
+
+      explicit
+      negative_binomial_distribution(_IntType __k = 1, double __p = 0.5)
+      : _M_param(__k, __p)
+      { }
+
+      explicit
+      negative_binomial_distribution(const param_type& __p)
+      : _M_param(__p)
+      { }
+
+      /**
+       * @brief Resets the distribution state.
+       */
+      void
+      reset()
+      { }
+
+      /**
+       * @brief Return the @f$ k @f$ parameter of the distribution.
+       */
+      _IntType
+      k() const
+      { return _M_param.k(); }
+
+      /**
+       * @brief Return the @f$ p @f$ parameter of the distribution.
+       */
+      double
+      p() const
+      { return _M_param.p(); }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the greatest lower bound value of the distribution.
+       */
+      result_type
+      min() const
+      { return result_type(0); }
+
+      /**
+       * @brief Returns the least upper bound value of the distribution.
+       */
+      result_type
+      max() const
+      { return std::numeric_limits<result_type>::max(); }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng)
+       { return this->operator()(__urng, this->param()); }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng,
+                  const param_type& __p);
+
+    private:
+      param_type _M_param;
+    };
+
+  /**
+   * @brief Return true if two negative binomial distributions have
+   *        the same parameters.
+   */
+  template<typename _IntType>
+    bool
+    operator==(const negative_binomial_distribution<_IntType>& __d1,
+              const negative_binomial_distribution<_IntType>& __d2)
+    { return __d1.param() == __d2.param(); }
+
+  /**
+   * @brief Inserts a %negative_binomial_distribution random
+   *        number distribution @p __x into the output stream @p __os.
+   *
+   * @param __os An output stream.
+   * @param __x  A %negative_binomial_distribution random number
+   *             distribution.
+   *
+   * @returns The output stream with the state of @p __x inserted or in
+   *          an error state.
+   */
+  template<typename _IntType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const negative_binomial_distribution<_IntType>& __x);
+
+  /**
+   * @brief Extracts a %negative_binomial_distribution random number
+   *        distribution @p __x from the input stream @p __is.
+   *
+   * @param __is An input stream.
+   * @param __x A %negative_binomial_distribution random number
+   *            generator engine.
+   *
+   * @returns The input stream with @p __x extracted or in an error state.
+   */
+  template<typename _IntType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              negative_binomial_distribution<_IntType>& __x);
+
+  /* @} */ // group std_random_distributions_bernoulli
+
+  /**
+   * @addtogroup std_random_distributions_poisson Poisson Distributions
+   * @ingroup std_random_distributions
+   * @{
+   */
+
+  /**
+   * @brief A discrete Poisson random number distribution.
+   *
+   * The formula for the Poisson probability density function is
+   * @f$ p(i|\mu) = \frac{\mu^i}{i!} e^{-\mu} @f$ where @f$ \mu @f$ is the
+   * parameter of the distribution.
+   */
+  template<typename _IntType = int>
+    class poisson_distribution
+    {
+      __glibcxx_class_requires(_IntType, _IntegerConcept)
+
+    public:
+      /** The type of the range of the distribution. */
+      typedef _IntType  result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+       typedef poisson_distribution<_IntType> distribution_type;
+       friend class poisson_distribution<_IntType>;
+
+       explicit
+       param_type(double __mean = 1.0)
+       : _M_mean(__mean)
+       {
+         _GLIBCXX_DEBUG_ASSERT(_M_mean > 0.0);
+         _M_initialize();
+       }
+
+       double
+       mean() const
+       { return _M_mean; }
+
+       friend bool
+       operator==(const param_type& __p1, const param_type& __p2)
+       { return __p1._M_mean == __p2._M_mean; }
+
+      private:
+       // Hosts either log(mean) or the threshold of the simple method.
+       void
+       _M_initialize();
+
+       double _M_mean;
+
+       double _M_lm_thr;
+#if _GLIBCXX_USE_C99_MATH_TR1
+       double _M_lfm, _M_sm, _M_d, _M_scx, _M_1cx, _M_c2b, _M_cb;
+#endif
+      };
+
+      // constructors and member function
+      explicit
+      poisson_distribution(double __mean = 1.0)
+      : _M_param(__mean), _M_nd()
+      { }
+
+      explicit
+      poisson_distribution(const param_type& __p)
+      : _M_param(__p), _M_nd()
+      { }
+
+      /**
+       * @brief Resets the distribution state.
+       */
+      void
+      reset()
+      { _M_nd.reset(); }
+
+      /**
+       * @brief Returns the distribution parameter @p mean.
+       */
+      double
+      mean() const
+      { return _M_param.mean(); }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the greatest lower bound value of the distribution.
+       */
+      result_type
+      min() const
+      { return 0; }
+
+      /**
+       * @brief Returns the least upper bound value of the distribution.
+       */
+      result_type
+      max() const
+      { return std::numeric_limits<result_type>::max(); }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng)
+       { return this->operator()(__urng, this->param()); }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng,
+                  const param_type& __p);
+
+      /**
+       * @brief Return true if two Poisson distributions have the same
+       *        parameters.
+       */
+      template<typename _IntType1>
+       friend bool
+       operator==(const poisson_distribution<_IntType1>& __d1,
+                  const poisson_distribution<_IntType1>& __d2)
+       { return (__d1.param() == __d2.param())
+             && (__d1._M_nd == __d2._M_nd); }
+
+      /**
+       * @brief Inserts a %poisson_distribution random number distribution
+       * @p __x into the output stream @p __os.
+       *
+       * @param __os An output stream.
+       * @param __x  A %poisson_distribution random number distribution.
+       *
+       * @returns The output stream with the state of @p __x inserted or in
+       * an error state.
+       */
+      template<typename _IntType1, typename _CharT, typename _Traits>
+       friend std::basic_ostream<_CharT, _Traits>&
+       operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+                  const poisson_distribution<_IntType1>& __x);
+
+      /**
+       * @brief Extracts a %poisson_distribution random number distribution
+       * @p __x from the input stream @p __is.
+       *
+       * @param __is An input stream.
+       * @param __x  A %poisson_distribution random number generator engine.
+       *
+       * @returns The input stream with @p __x extracted or in an error
+       *          state.
+       */
+      template<typename _IntType1, typename _CharT, typename _Traits>
+       friend std::basic_istream<_CharT, _Traits>&
+       operator>>(std::basic_istream<_CharT, _Traits>& __is,
+                  poisson_distribution<_IntType1>& __x);
+
+    private:
+      param_type _M_param;
+
+      // NB: Unused when _GLIBCXX_USE_C99_MATH_TR1 is undefined.
+      normal_distribution<double> _M_nd;
+    };
+
+  /**
+   * @brief An exponential continuous distribution for random numbers.
+   *
+   * The formula for the exponential probability density function is
+   * @f$ p(x|\lambda) = \lambda e^{-\lambda x} @f$.
+   *
+   * <table border=1 cellpadding=10 cellspacing=0>
+   * <caption align=top>Distribution Statistics</caption>
+   * <tr><td>Mean</td><td>@f$ \frac{1}{\lambda} @f$</td></tr>
+   * <tr><td>Median</td><td>@f$ \frac{\ln 2}{\lambda} @f$</td></tr>
+   * <tr><td>Mode</td><td>@f$ zero @f$</td></tr>
+   * <tr><td>Range</td><td>@f$[0, \infty]@f$</td></tr>
+   * <tr><td>Standard Deviation</td><td>@f$ \frac{1}{\lambda} @f$</td></tr>
+   * </table>
+   */
+  template<typename _RealType = double>
+    class exponential_distribution
+    {
+    public:
+      /** The type of the range of the distribution. */
+      typedef _RealType result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+       typedef exponential_distribution<_RealType> distribution_type;
+
+       explicit
+       param_type(_RealType __lambda = _RealType(1))
+       : _M_lambda(__lambda)
+       {
+         _GLIBCXX_DEBUG_ASSERT(_M_lambda > _RealType(0));
+       }
+
+       _RealType
+       lambda() const
+       { return _M_lambda; }
+
+       friend bool
+       operator==(const param_type& __p1, const param_type& __p2)
+       { return __p1._M_lambda == __p2._M_lambda; }
+
+      private:
+       _RealType _M_lambda;
+      };
+
+    public:
+      /**
+       * @brief Constructs an exponential distribution with inverse scale
+       *        parameter @f$ \lambda @f$.
+       */
+      explicit
+      exponential_distribution(const result_type& __lambda = result_type(1))
+      : _M_param(__lambda)
+      { }
+
+      explicit
+      exponential_distribution(const param_type& __p)
+      : _M_param(__p)
+      { }
+
+      /**
+       * @brief Resets the distribution state.
+       *
+       * Has no effect on exponential distributions.
+       */
+      void
+      reset() { }
+
+      /**
+       * @brief Returns the inverse scale parameter of the distribution.
+       */
+      _RealType
+      lambda() const
+      { return _M_param.lambda(); }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the greatest lower bound value of the distribution.
+       */
+      result_type
+      min() const
+      { return result_type(0); }
+
+      /**
+       * @brief Returns the least upper bound value of the distribution.
+       */
+      result_type
+      max() const
+      { return std::numeric_limits<result_type>::max(); }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng)
+       {
+         __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
+           __aurng(__urng);
+         return -std::log(__aurng()) / this->lambda();
+       }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng,
+                  const param_type& __p)
+       {
+         __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
+           __aurng(__urng);
+         return -std::log(__aurng()) / __p.lambda();
+       }
+
+    private:
+      param_type _M_param;
+    };
+
+  /**
+   * @brief Return true if two exponential distributions have the same
+   *        parameters.
+   */
+  template<typename _RealType>
+    bool
+    operator==(const exponential_distribution<_RealType>& __d1,
+              const exponential_distribution<_RealType>& __d2)
+    { return __d1.param() == __d2.param(); }
+
+  /**
+   * @brief Inserts a %exponential_distribution random number distribution
+   * @p __x into the output stream @p __os.
+   *
+   * @param __os An output stream.
+   * @param __x  A %exponential_distribution random number distribution.
+   *
+   * @returns The output stream with the state of @p __x inserted or in
+   * an error state.
+   */
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const exponential_distribution<_RealType>& __x);
+
+  /**
+   * @brief Extracts a %exponential_distribution random number distribution
+   * @p __x from the input stream @p __is.
+   *
+   * @param __is An input stream.
+   * @param __x A %exponential_distribution random number
+   *            generator engine.
+   *
+   * @returns The input stream with @p __x extracted or in an error state.
+   */
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              exponential_distribution<_RealType>& __x);
+
+
+  /**
+   * @brief A gamma continuous distribution for random numbers.
+   *
+   * The formula for the gamma probability density function is
+   * @f$ p(x|\alpha,\beta) = \frac{1}{\beta\Gamma(\alpha)}
+   *                         (x/\beta)^{\alpha - 1} e^{-x/\beta} @f$.
+   */
+  template<typename _RealType = double>
+    class gamma_distribution
+    {
+    public:
+      /** The type of the range of the distribution. */
+      typedef _RealType result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+       typedef gamma_distribution<_RealType> distribution_type;
+       friend class gamma_distribution<_RealType>;
+
+       explicit
+       param_type(_RealType __alpha = _RealType(1),
+                  _RealType __beta = _RealType(1))
+       : _M_alpha(__alpha), _M_beta(__beta)
+       {
+         _GLIBCXX_DEBUG_ASSERT(_M_alpha > _RealType(0));
+         _M_initialize();
+       }
+
+       _RealType
+       alpha() const
+       { return _M_alpha; }
+
+       _RealType
+       beta() const
+       { return _M_beta; }
+
+       friend bool
+       operator==(const param_type& __p1, const param_type& __p2)
+       { return (__p1._M_alpha == __p2._M_alpha)
+             && (__p1._M_beta == __p2._M_beta); }
+
+      private:
+       void
+       _M_initialize();
+
+       _RealType _M_alpha;
+       _RealType _M_beta;
+
+       // Hosts either lambda of GB or d of modified Vaduva's.
+       _RealType _M_l_d;
+      };
+
+    public:
+      /**
+       * @brief Constructs a gamma distribution with parameters
+       * @f$ \alpha @f$ and @f$ \beta @f$.
+       */
+      explicit
+      gamma_distribution(_RealType __alpha = _RealType(1),
+                        _RealType __beta = _RealType(1))
+      : _M_param(__alpha, __beta)
+      { }
+
+      explicit
+      gamma_distribution(const param_type& __p)
+      : _M_param(__p)
+      { }
+
+      /**
+       * @brief Resets the distribution state.
+       *
+       * Does nothing for the gamma distribution.
+       */
+      void
+      reset() { }
+
+      /**
+       * @brief Returns the @f$ \alpha @f$ of the distribution.
+       */
+      _RealType
+      alpha() const
+      { return _M_param.alpha(); }
+
+      /**
+       * @brief Returns the @f$ \beta @f$ of the distribution.
+       */
+      _RealType
+      beta() const
+      { return _M_param.beta(); }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the greatest lower bound value of the distribution.
+       */
+      result_type
+      min() const
+      { return result_type(0); }
+
+      /**
+       * @brief Returns the least upper bound value of the distribution.
+       */
+      result_type
+      max() const
+      { return std::numeric_limits<result_type>::max(); }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng)
+       { return this->operator()(__urng, this->param()); }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng,
+                  const param_type& __p);
+
+    private:
+      param_type _M_param;
+    };
+
+  /**
+   * @brief Return true if two gamma distributions have the same
+   *        parameters.
+   */
+  template<typename _RealType>
+    bool
+    operator==(const gamma_distribution<_RealType>& __d1,
+              const gamma_distribution<_RealType>& __d2)
+    { return __d1.param() == __d2.param(); }
+
+  /**
+   * @brief Inserts a %gamma_distribution random number distribution
+   * @p __x into the output stream @p __os.
+   *
+   * @param __os An output stream.
+   * @param __x  A %gamma_distribution random number distribution.
+   *
+   * @returns The output stream with the state of @p __x inserted or in
+   * an error state.
+   */
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const gamma_distribution<_RealType>& __x);
+
+  /**
+   * @brief Extracts a %gamma_distribution random number distribution
+   * @p __x from the input stream @p __is.
+   *
+   * @param __is An input stream.
+   * @param __x  A %gamma_distribution random number generator engine.
+   *
+   * @returns The input stream with @p __x extracted or in an error state.
+   */
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              gamma_distribution<_RealType>& __x);
+
+
+  /**
+   * @brief A weibull_distribution random number distribution.
+   *
+   * The formula for the normal probability density function is
+   * @f$ p(x|\alpha,\beta) = \frac{a}{b} (frac{x}{b})^{a-1}
+   *                         \exp{(-(frac{x}{b})^a)} @f$.
+   */
+  template<typename _RealType = double>
+    class weibull_distribution
+    {
+    public:
+      /** The type of the range of the distribution. */
+      typedef _RealType result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+       typedef weibull_distribution<_RealType> distribution_type;
+
+       explicit
+       param_type(_RealType __a = _RealType(1),
+                  _RealType __b = _RealType(1))
+       : _M_a(__a), _M_b(__b)
+       { }
+
+       _RealType
+       a() const
+       { return _M_a; }
+
+       _RealType
+       b() const
+       { return _M_b; }
+
+       friend bool
+       operator==(const param_type& __p1, const param_type& __p2)
+       { return (__p1._M_a == __p2._M_a) && (__p1._M_b == __p2._M_b); }
+
+      private:
+       _RealType _M_a;
+       _RealType _M_b;
+      };
+
+      explicit
+      weibull_distribution(_RealType __a = _RealType(1),
+                          _RealType __b = _RealType(1))
+      : _M_param(__a, __b)
+      { }
+
+      explicit
+      weibull_distribution(const param_type& __p)
+      : _M_param(__p)
+      { }
+
+      /**
+       * @brief Resets the distribution state.
+       */
+      void
+      reset()
+      { }
+
+      /**
+       * @brief Return the @f$ a @f$ parameter of the distribution.
+       */
+      _RealType
+      a() const
+      { return _M_param.a(); }
+
+      /**
+       * @brief Return the @f$ b @f$ parameter of the distribution.
+       */
+      _RealType
+      b() const
+      { return _M_param.b(); }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the greatest lower bound value of the distribution.
+       */
+      result_type
+      min() const
+      { return result_type(0); }
+
+      /**
+       * @brief Returns the least upper bound value of the distribution.
+       */
+      result_type
+      max() const
+      { return std::numeric_limits<result_type>::max(); }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng)
+       { return this->operator()(__urng, this->param()); }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng,
+                  const param_type& __p)
+       {
+         __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
+           __aurng(__urng);
+         return __p.b() * std::pow(-std::log(__aurng()),
+                                   result_type(1) / __p.a());
+       }
+
+    private:
+      param_type _M_param;
+    };
+
+  /**
+   * @brief Return true if two Weibull distributions have the same
+   *        parameters.
+   */
+  template<typename _RealType>
+    bool
+    operator==(const weibull_distribution<_RealType>& __d1,
+              const weibull_distribution<_RealType>& __d2)
+    { return __d1.param() == __d2.param(); }
+
+  /**
+   * @brief Inserts a %weibull_distribution random number distribution
+   * @p __x into the output stream @p __os.
+   *
+   * @param __os An output stream.
+   * @param __x  A %weibull_distribution random number distribution.
+   *
+   * @returns The output stream with the state of @p __x inserted or in
+   * an error state.
+   */
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const weibull_distribution<_RealType>& __x);
+
+  /**
+   * @brief Extracts a %weibull_distribution random number distribution
+   * @p __x from the input stream @p __is.
+   *
+   * @param __is An input stream.
+   * @param __x A %weibull_distribution random number
+   *            generator engine.
+   *
+   * @returns The input stream with @p __x extracted or in an error state.
+   */
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              weibull_distribution<_RealType>& __x);
+
+
+  /**
+   * @brief A extreme_value_distribution random number distribution.
+   *
+   * The formula for the normal probability mass function is
+   * @f$ p(x|a,b) = \frac{1}{b}
+   *                \exp( \frac{a-x}{b} - \exp(\frac{a-x}{b})) @f$
+   */
+  template<typename _RealType = double>
+    class extreme_value_distribution
+    {
+    public:
+      /** The type of the range of the distribution. */
+      typedef _RealType result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+       typedef extreme_value_distribution<_RealType> distribution_type;
+
+       explicit
+       param_type(_RealType __a = _RealType(0),
+                  _RealType __b = _RealType(1))
+       : _M_a(__a), _M_b(__b)
+       { }
+
+       _RealType
+       a() const
+       { return _M_a; }
+
+       _RealType
+       b() const
+       { return _M_b; }
+
+       friend bool
+       operator==(const param_type& __p1, const param_type& __p2)
+       { return (__p1._M_a == __p2._M_a) && (__p1._M_b == __p2._M_b); }
+
+      private:
+       _RealType _M_a;
+       _RealType _M_b;
+      };
+
+      explicit
+      extreme_value_distribution(_RealType __a = _RealType(0),
+                                _RealType __b = _RealType(1))
+      : _M_param(__a, __b)
+      { }
+
+      explicit
+      extreme_value_distribution(const param_type& __p)
+      : _M_param(__p)
+      { }
+
+      /**
+       * @brief Resets the distribution state.
+       */
+      void
+      reset()
+      { }
+
+      /**
+       * @brief Return the @f$ a @f$ parameter of the distribution.
+       */
+      _RealType
+      a() const
+      { return _M_param.a(); }
+
+      /**
+       * @brief Return the @f$ b @f$ parameter of the distribution.
+       */
+      _RealType
+      b() const
+      { return _M_param.b(); }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the greatest lower bound value of the distribution.
+       */
+      result_type
+      min() const
+      { return std::numeric_limits<result_type>::min(); }
+
+      /**
+       * @brief Returns the least upper bound value of the distribution.
+       */
+      result_type
+      max() const
+      { return std::numeric_limits<result_type>::max(); }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng)
+       { return this->operator()(__urng, this->param()); }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng,
+                  const param_type& __p);
+
+    private:
+      param_type _M_param;
+    };
+
+  /**
+   *
+   */
+  template<typename _RealType>
+    bool
+    operator==(const extreme_value_distribution<_RealType>& __d1,
+              const extreme_value_distribution<_RealType>& __d2)
+    { return __d1.param() == __d2.param(); }
+
+  /**
+   * @brief Inserts a %extreme_value_distribution random number distribution
+   * @p __x into the output stream @p __os.
+   *
+   * @param __os An output stream.
+   * @param __x  A %extreme_value_distribution random number distribution.
+   *
+   * @returns The output stream with the state of @p __x inserted or in
+   * an error state.
+   */
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const extreme_value_distribution<_RealType>& __x);
+
+  /**
+   * @brief Extracts a %extreme_value_distribution random number
+   *        distribution @p __x from the input stream @p __is.
+   *
+   * @param __is An input stream.
+   * @param __x A %extreme_value_distribution random number
+   *            generator engine.
+   *
+   * @returns The input stream with @p __x extracted or in an error state.
+   */
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              extreme_value_distribution<_RealType>& __x);
+
+
+  /**
+   * @brief A discrete_distribution random number distribution.
+   *
+   * The formula for the discrete probability mass function is
+   *
+   */
+  template<typename _IntType = int>
+    class discrete_distribution
+    {
+      __glibcxx_class_requires(_IntType, _IntegerConcept)
+
+    public:
+      /** The type of the range of the distribution. */
+      typedef _IntType result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+       typedef discrete_distribution<_IntType> distribution_type;
+       friend class discrete_distribution<_IntType>;
+
+       param_type()
+       : _M_prob(), _M_cp()
+       { _M_initialize(); }
+
+       template<typename _InputIterator>
+         param_type(_InputIterator __wbegin,
+                    _InputIterator __wend)
+         : _M_prob(__wbegin, __wend), _M_cp()
+         { _M_initialize(); }
+
+       param_type(initializer_list<double> __wil)
+       : _M_prob(__wil.begin(), __wil.end()), _M_cp()
+       { _M_initialize(); }
+
+       template<typename _Func>
+         param_type(size_t __nw, double __xmin, double __xmax,
+                    _Func __fw);
+
+       std::vector<double>
+       probabilities() const
+       { return _M_prob; }
+
+       friend bool
+       operator==(const param_type& __p1, const param_type& __p2)
+       { return __p1._M_prob == __p2._M_prob; }
+
+      private:
+       void
+       _M_initialize();
+
+       std::vector<double> _M_prob;
+       std::vector<double> _M_cp;
+      };
+
+      discrete_distribution()
+      : _M_param()
+      { }
+
+      template<typename _InputIterator>
+       discrete_distribution(_InputIterator __wbegin,
+                             _InputIterator __wend)
+       : _M_param(__wbegin, __wend)
+       { }
+
+      discrete_distribution(initializer_list<double> __wil)
+      : _M_param(__wil)
+      { }
+
+      template<typename _Func>
+       discrete_distribution(size_t __nw, double __xmin, double __xmax,
+                             _Func __fw)
+       : _M_param(__nw, __xmin, __xmax, __fw)
+       { }
+
+      explicit
+      discrete_distribution(const param_type& __p)
+      : _M_param(__p)
+      { }
+
+      /**
+       * @brief Resets the distribution state.
+       */
+      void
+      reset()
+      { }
+
+      /**
+       * @brief Returns the probabilities of the distribution.
+       */
+      std::vector<double>
+      probabilities() const
+      { return _M_param.probabilities(); }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the greatest lower bound value of the distribution.
+       */
+      result_type
+      min() const
+      { return result_type(0); }
+
+      /**
+       * @brief Returns the least upper bound value of the distribution.
+       */
+      result_type
+      max() const
+      { return this->_M_param._M_prob.size() - 1; }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng)
+       { return this->operator()(__urng, this->param()); }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng,
+                  const param_type& __p);
+
+      /**
+       * @brief Inserts a %discrete_distribution random number distribution
+       * @p __x into the output stream @p __os.
+       *
+       * @param __os An output stream.
+       * @param __x  A %discrete_distribution random number distribution.
+       *
+       * @returns The output stream with the state of @p __x inserted or in
+       * an error state.
+       */
+      template<typename _IntType1, typename _CharT, typename _Traits>
+       friend std::basic_ostream<_CharT, _Traits>&
+       operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+                  const discrete_distribution<_IntType1>& __x);
+
+      /**
+       * @brief Extracts a %discrete_distribution random number distribution
+       * @p __x from the input stream @p __is.
+       *
+       * @param __is An input stream.
+       * @param __x A %discrete_distribution random number
+       *            generator engine.
+       *
+       * @returns The input stream with @p __x extracted or in an error
+       *          state.
+       */
+      template<typename _IntType1, typename _CharT, typename _Traits>
+       friend std::basic_istream<_CharT, _Traits>&
+       operator>>(std::basic_istream<_CharT, _Traits>& __is,
+                  discrete_distribution<_IntType1>& __x);
+
+    private:
+      param_type _M_param;
+    };
+
+  /**
+   *
+   */
+  template<typename _IntType>
+    bool
+    operator==(const discrete_distribution<_IntType>& __d1,
+              const discrete_distribution<_IntType>& __d2)
+    { return __d1.param() == __d2.param(); }
+
+
+  /**
+   * @brief A piecewise_constant_distribution random number distribution.
+   *
+   * The formula for the piecewise constant probability mass function is
+   *
+   */
+  template<typename _RealType = double>
+    class piecewise_constant_distribution
+    {
+    public:
+      /** The type of the range of the distribution. */
+      typedef _RealType result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+       typedef piecewise_constant_distribution<_RealType> distribution_type;
+       friend class piecewise_constant_distribution<_RealType>;
+
+       param_type();
+
+       template<typename _InputIteratorB, typename _InputIteratorW>
+         param_type(_InputIteratorB __bfirst,
+                    _InputIteratorB __bend,
+                    _InputIteratorW __wbegin);
+
+       template<typename _Func>
+         param_type(initializer_list<_RealType> __bil, _Func __fw);
+
+       template<typename _Func>
+         param_type(size_t __nw, _RealType __xmin, _RealType __xmax,
+                    _Func __fw);
+
+       std::vector<_RealType>
+       intervals() const
+       { return _M_int; }
+
+       std::vector<double>
+       densities() const
+       { return _M_den; }
+
+       friend bool
+       operator==(const param_type& __p1, const param_type& __p2)
+       { return (__p1._M_int == __p2._M_int)
+             && (__p1._M_den == __p2._M_den); }
+
+      private:
+       void
+       _M_initialize();
+
+       std::vector<_RealType> _M_int;
+       std::vector<double> _M_den;
+       std::vector<double> _M_cp;
+      };
+
+      explicit
+      piecewise_constant_distribution()
+      : _M_param()
+      { }
+
+      template<typename _InputIteratorB, typename _InputIteratorW>
+       piecewise_constant_distribution(_InputIteratorB __bfirst,
+                                       _InputIteratorB __bend,
+                                       _InputIteratorW __wbegin)
+       : _M_param(__bfirst, __bend, __wbegin)
+       { }
+
+      template<typename _Func>
+       piecewise_constant_distribution(initializer_list<_RealType> __bil,
+                                       _Func __fw)
+       : _M_param(__bil, __fw)
+       { }
+
+      template<typename _Func>
+       piecewise_constant_distribution(size_t __nw,
+                                       _RealType __xmin, _RealType __xmax,
+                                       _Func __fw)
+       : _M_param(__nw, __xmin, __xmax, __fw)
+       { }
+
+      explicit
+      piecewise_constant_distribution(const param_type& __p)
+      : _M_param(__p)
+      { }
+
+      /**
+       * @brief Resets the distribution state.
+       */
+      void
+      reset()
+      { }
+
+      /**
+       * @brief Returns a vector of the intervals.
+       */
+      std::vector<_RealType>
+      intervals() const
+      { return _M_param.intervals(); }
+
+      /**
+       * @brief Returns a vector of the probability densities.
+       */
+      std::vector<double>
+      densities() const
+      { return _M_param.densities(); }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the greatest lower bound value of the distribution.
+       */
+      result_type
+      min() const
+      { return this->_M_param._M_int.front(); }
+
+      /**
+       * @brief Returns the least upper bound value of the distribution.
+       */
+      result_type
+      max() const
+      { return this->_M_param._M_int.back(); }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng)
+       { return this->operator()(__urng, this->param()); }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng,
+                  const param_type& __p);
+
+      /**
+       * @brief Inserts a %piecewise_constan_distribution random
+       *        number distribution @p __x into the output stream @p __os.
+       *
+       * @param __os An output stream.
+       * @param __x  A %piecewise_constan_distribution random number
+       *             distribution.
+       *
+       * @returns The output stream with the state of @p __x inserted or in
+       * an error state.
+       */
+      template<typename _RealType1, typename _CharT, typename _Traits>
+       friend std::basic_ostream<_CharT, _Traits>&
+       operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+                  const piecewise_constant_distribution<_RealType1>& __x);
+
+      /**
+       * @brief Extracts a %piecewise_constan_distribution random
+       *        number distribution @p __x from the input stream @p __is.
+       *
+       * @param __is An input stream.
+       * @param __x A %piecewise_constan_distribution random number
+       *            generator engine.
+       *
+       * @returns The input stream with @p __x extracted or in an error
+       *          state.
+       */
+      template<typename _RealType1, typename _CharT, typename _Traits>
+       friend std::basic_istream<_CharT, _Traits>&
+       operator>>(std::basic_istream<_CharT, _Traits>& __is,
+                  piecewise_constant_distribution<_RealType1>& __x);
+
+    private:
+      param_type _M_param;
+    };
+
+  /**
+   *
+   */
+  template<typename _RealType>
+    bool
+    operator==(const piecewise_constant_distribution<_RealType>& __d1,
+              const piecewise_constant_distribution<_RealType>& __d2)
+    { return __d1.param() == __d2.param(); }
+
+
+  /**
+   * @brief A piecewise_linear_distribution random number distribution.
+   *
+   * The formula for the piecewise linear probability mass function is
+   *
+   */
+  template<typename _RealType = double>
+    class piecewise_linear_distribution
+    {
+    public:
+      /** The type of the range of the distribution. */
+      typedef _RealType result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+       typedef piecewise_linear_distribution<_RealType> distribution_type;
+       friend class piecewise_linear_distribution<_RealType>;
+
+       param_type();
+
+       template<typename _InputIteratorB, typename _InputIteratorW>
+         param_type(_InputIteratorB __bfirst,
+                    _InputIteratorB __bend,
+                    _InputIteratorW __wbegin);
+
+       template<typename _Func>
+         param_type(initializer_list<_RealType> __bil, _Func __fw);
+
+       template<typename _Func>
+         param_type(size_t __nw, _RealType __xmin, _RealType __xmax,
+                    _Func __fw);
+
+       std::vector<_RealType>
+       intervals() const
+       { return _M_int; }
+
+       std::vector<double>
+       densities() const
+       { return _M_den; }
+
+       friend bool
+       operator==(const param_type& __p1, const param_type& __p2)
+       { return (__p1._M_int == __p2._M_int)
+             && (__p1._M_den == __p2._M_den); }
+
+      private:
+       void
+       _M_initialize();
+
+       std::vector<_RealType> _M_int;
+       std::vector<double> _M_den;
+       std::vector<double> _M_cp;
+       std::vector<double> _M_m;
+      };
+
+      explicit
+      piecewise_linear_distribution()
+      : _M_param()
+      { }
+
+      template<typename _InputIteratorB, typename _InputIteratorW>
+       piecewise_linear_distribution(_InputIteratorB __bfirst,
+                                     _InputIteratorB __bend,
+                                     _InputIteratorW __wbegin)
+       : _M_param(__bfirst, __bend, __wbegin)
+       { }
+
+      template<typename _Func>
+       piecewise_linear_distribution(initializer_list<_RealType> __bil,
+                                     _Func __fw)
+       : _M_param(__bil, __fw)
+       { }
+
+      template<typename _Func>
+       piecewise_linear_distribution(size_t __nw,
+                                     _RealType __xmin, _RealType __xmax,
+                                     _Func __fw)
+       : _M_param(__nw, __xmin, __xmax, __fw)
+       { }
+
+      explicit
+      piecewise_linear_distribution(const param_type& __p)
+      : _M_param(__p)
+      { }
+
+      /**
+       * Resets the distribution state.
+       */
+      void
+      reset()
+      { }
+
+      /**
+       * @brief Return the intervals of the distribution.
+       */
+      std::vector<_RealType>
+      intervals() const
+      { return _M_param.intervals(); }
+
+      /**
+       * @brief Return a vector of the probability densities of the
+       *        distribution.
+       */
+      std::vector<double>
+      densities() const
+      { return _M_param.densities(); }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the greatest lower bound value of the distribution.
+       */
+      result_type
+      min() const
+      { return this->_M_param._M_int.front(); }
+
+      /**
+       * @brief Returns the least upper bound value of the distribution.
+       */
+      result_type
+      max() const
+      { return this->_M_param._M_int.back(); }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng)
+       { return this->operator()(__urng, this->param()); }
+
+      template<typename _UniformRandomNumberGenerator>
+       result_type
+       operator()(_UniformRandomNumberGenerator& __urng,
+                  const param_type& __p);
+
+      /**
+       * @brief Inserts a %piecewise_linear_distribution random number
+       *        distribution @p __x into the output stream @p __os.
+       *
+       * @param __os An output stream.
+       * @param __x  A %piecewise_linear_distribution random number
+       *             distribution.
+       *
+       * @returns The output stream with the state of @p __x inserted or in
+       *          an error state.
+       */
+      template<typename _RealType1, typename _CharT, typename _Traits>
+       friend std::basic_ostream<_CharT, _Traits>&
+       operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+                  const piecewise_linear_distribution<_RealType1>& __x);
+
+      /**
+       * @brief Extracts a %piecewise_linear_distribution random number
+       *        distribution @p __x from the input stream @p __is.
+       *
+       * @param __is An input stream.
+       * @param __x  A %piecewise_linear_distribution random number
+       *             generator engine.
+       *
+       * @returns The input stream with @p __x extracted or in an error
+       *          state.
+       */
+      template<typename _RealType1, typename _CharT, typename _Traits>
+       friend std::basic_istream<_CharT, _Traits>&
+       operator>>(std::basic_istream<_CharT, _Traits>& __is,
+                  piecewise_linear_distribution<_RealType1>& __x);
+
+    private:
+      param_type _M_param;
+    };
+
+  /**
+   *
+   */
+  template<typename _RealType>
+    bool
+    operator==(const piecewise_linear_distribution<_RealType>& __d1,
+              const piecewise_linear_distribution<_RealType>& __d2)
+    { return __d1.param() == __d2.param(); }
+
+  /* @} */ // group std_random_distributions_poisson
+
+  /* @} */ // group std_random_distributions
+
+  /**
+   * @addtogroup std_random_utilities Random Number Utilities
+   * @ingroup std_random
+   * @{
+   */
+
+  /**
+   * @brief The seed_seq class generates sequences of seeds for random
+   *        number generators.
+   */
+  class seed_seq
+  {
+
+  public:
+    /** The type of the seed vales. */
+    typedef uint_least32_t result_type;
+
+    /** Default constructor. */
+    seed_seq()
+    : _M_v()
+    { }
+
+    template<typename _IntType>
+      seed_seq(std::initializer_list<_IntType> il);
+
+    template<typename _InputIterator>
+      seed_seq(_InputIterator __begin, _InputIterator __end);
+
+    // generating functions
+    template<typename _RandomAccessIterator>
+      void
+      generate(_RandomAccessIterator __begin, _RandomAccessIterator __end);
+
+    // property functions
+    size_t size() const
+    { return _M_v.size(); }
+
+    template<typename OutputIterator>
+      void
+      param(OutputIterator __dest) const
+      { std::copy(_M_v.begin(), _M_v.end(), __dest); }
+
+  private:
+    ///
+    vector<result_type> _M_v;
+  };
+
+  /* @} */ // group std_random_utilities
+
+  /* @} */ // group std_random
+
+}
+
diff --git a/libstdc++-v3/include/bits/random.tcc b/libstdc++-v3/include/bits/random.tcc
new file mode 100644 (file)
index 0000000..0c4f7a4
--- /dev/null
@@ -0,0 +1,2794 @@
+// random number generation (out of line) -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/** @file bits/random.tcc
+ *  This is an internal header file, included by other library headers.
+ *  You should not attempt to use it directly.
+ */
+
+#include <iostream>
+#include <vector>
+#include <numeric>
+#include <algorithm>
+
+namespace std
+{
+
+  /*
+   * (Further) implementation-space details.
+   */
+  namespace __detail
+  {
+    // General case for x = (ax + c) mod m -- use Schrage's algorithm to
+    // avoid integer overflow.
+    //
+    // Because a and c are compile-time integral constants the compiler
+    // kindly elides any unreachable paths.
+    //
+    // Preconditions:  a > 0, m > 0.
+    //
+    template<typename _Tp, _Tp __a, _Tp __c, _Tp __m, bool>
+      struct _Mod
+      {
+       static _Tp
+       __calc(_Tp __x)
+       {
+         if (__a == 1)
+           __x %= __m;
+         else
+           {
+             static const _Tp __q = __m / __a;
+             static const _Tp __r = __m % __a;
+
+             _Tp __t1 = __a * (__x % __q);
+             _Tp __t2 = __r * (__x / __q);
+             if (__t1 >= __t2)
+               __x = __t1 - __t2;
+             else
+               __x = __m - __t2 + __t1;
+           }
+
+         if (__c != 0)
+           {
+             const _Tp __d = __m - __x;
+             if (__d > __c)
+               __x += __c;
+             else
+               __x = __c - __d;
+           }
+         return __x;
+       }
+      };
+
+    // Special case for m == 0 -- use unsigned integer overflow as modulo
+    // operator.
+    template<typename _Tp, _Tp __a, _Tp __c, _Tp __m>
+      struct _Mod<_Tp, __a, __c, __m, true>
+      {
+       static _Tp
+       __calc(_Tp __x)
+       { return __a * __x + __c; }
+      };
+  } // namespace __detail
+
+  /**
+   * Seeds the LCR with integral value @p __x0, adjusted so that the
+   * ring identity is never a member of the convergence set.
+   */
+  template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+    void
+    linear_congruential_engine<_UIntType, __a, __c, __m>::
+    seed(_UIntType __x0)
+    {
+      if ((__detail::__mod<_UIntType, 1U, 0U, __m>(__c) == 0U)
+       && (__detail::__mod<_UIntType, 1U, 0U, __m>(__x0) == 0U))
+       _M_x = __detail::__mod<_UIntType, 1U, 0U, __m>(1U);
+      else
+       _M_x = __detail::__mod<_UIntType, 1U, 0U, __m>(__x0);
+    }
+
+  /**
+   * Seeds the LCR engine with a value generated by @p __g.
+   */
+  template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+    void
+    linear_congruential_engine<_UIntType, __a, __c, __m>::
+    seed(seed_seq& __q)
+    {
+      const _UIntType __k = (std::log2(__m) + 31) / 32;
+      _UIntType __arr[__k + 3];
+      __q.generate(__arr + 0, __arr + 3);
+      _UIntType __factor = 1U;
+      _UIntType __sum = 0U;
+      for (size_t __i = 0; __i < __k; ++__i)
+        {
+          __sum += __arr[__i + 3] * __factor;
+          __factor *= __detail::_Shift<_UIntType, 32>::__value;
+        }
+
+      if ((__detail::__mod<_UIntType, 1U, 0U, __m>(__c) == 0U)
+       && (__detail::__mod<_UIntType, 1U, 0U, __m>(__sum) == 0U))
+        _M_x = __detail::__mod<_UIntType, 1U, 0U, __m>(1U);
+      else
+        _M_x = __detail::__mod<_UIntType, 1U, 0U, __m>(__sum);
+    }
+
+  /**
+   * Seeds the LCR engine with a value generated by @p __g.
+   */
+  template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+    template<typename _Gen>
+      void
+      linear_congruential_engine<_UIntType, __a, __c, __m>::
+      seed(_Gen& __g, false_type)
+      {
+       _UIntType __x0 = __g();
+       if ((__detail::__mod<_UIntType, 1U, 0U, __m>(__c) == 0U)
+        && (__detail::__mod<_UIntType, 1U, 0U, __m>(__x0) == 0U))
+         _M_x = __detail::__mod<_UIntType, 1U, 0U, __m>(1U);
+       else
+         _M_x = __detail::__mod<_UIntType, 1U, 0U, __m>(__x0);
+      }
+
+  /**
+   * Gets the next generated value in sequence.
+   */
+  template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+    typename linear_congruential_engine<_UIntType, __a, __c, __m>::
+            result_type
+    linear_congruential_engine<_UIntType, __a, __c, __m>::
+    operator()()
+    {
+      _M_x = __detail::__mod<_UIntType, __a, __c, __m>(_M_x);
+      return _M_x;
+    }
+
+  template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m,
+          typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const linear_congruential_engine<_UIntType,
+                                               __a, __c, __m>& __lcr)
+    {
+      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;
+      typedef typename __ostream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __os.flags();
+      const _CharT __fill = __os.fill();
+      __os.flags(__ios_base::dec
+              | __ios_base::fixed
+              | __ios_base::left);
+      __os.fill(__os.widen(' '));
+
+      __os << __lcr._M_x;
+
+      __os.flags(__flags);
+      __os.fill(__fill);
+      return __os;
+    }
+
+  template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m,
+          typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              linear_congruential_engine<_UIntType, __a, __c, __m>& __lcr)
+    {
+      typedef std::basic_istream<_CharT, _Traits>  __istream_type;
+      typedef typename __istream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __is.flags();
+      __is.flags(__ios_base::dec);
+
+      __is >> __lcr._M_x;
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _UIntType,
+          size_t __w, size_t __n, size_t __m, size_t __r,
+          _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+          _UIntType __b, size_t __t, _UIntType __c, size_t __l,
+          _UIntType __f>
+    void
+    mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
+                           __s, __b, __t, __c, __l, __f>::
+    seed(result_type __sd)
+    {
+      _M_x[0] = __detail::__mod<_UIntType, 1, 0,
+       __detail::_Shift<_UIntType, __w>::__value>(__sd);
+
+      for (size_t __i = 1; __i < state_size; ++__i)
+       {
+         _UIntType __x = _M_x[__i - 1];
+         __x ^= __x >> (__w - 2);
+         __x *= __f;
+         __x += __i;
+         _M_x[__i] = __detail::__mod<_UIntType, 1, 0,
+           __detail::_Shift<_UIntType, __w>::__value>(__x);
+       }
+      _M_p = state_size;
+    }
+
+  template<typename _UIntType,
+          size_t __w, size_t __n, size_t __m, size_t __r,
+          _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+          _UIntType __b, size_t __t, _UIntType __c, size_t __l,
+          _UIntType __f>
+    void
+    mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
+                             __s, __b, __t, __c, __l, __f>::
+    seed(seed_seq& __q)
+    {
+      const _UIntType __upper_mask = (~_UIntType()) << __r;
+      const size_t __k = (__w + 31) / 32;
+      _UIntType __arr[__k * __n];
+      __q.generate(__arr + 0, __arr + __k * __n);
+
+      bool __zero = true;
+      for (size_t __i = 0; __i < state_size; ++__i)
+        {
+          _UIntType __factor = 1U;
+          _UIntType __sum = 0U;
+          for (size_t __j = 0; __j < __k; ++__j)
+            {
+             __sum += __arr[__i * __k + __j] * __factor;
+             __factor *= __detail::_Shift<_UIntType, 32>::__value;
+            }
+          _M_x[__i] = __detail::__mod<_UIntType, 1U, 0U,
+                     __detail::_Shift<_UIntType, __w>::__value>(__sum);
+
+          if (__zero)
+            {
+             if (__i == 0)
+               {
+                 if ((_M_x[0] & __upper_mask) != 0U)
+                   __zero = false;
+               }
+             else if (_M_x[__i] != 0U)
+               __zero = false;
+            }
+        }
+        if (__zero)
+          _M_x[0] = __detail::_Shift<_UIntType, __w - 1U>::__value;
+    }
+
+  template<typename _UIntType, size_t __w,
+          size_t __n, size_t __m, size_t __r,
+          _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+          _UIntType __b, size_t __t, _UIntType __c, size_t __l,
+          _UIntType __f>
+    typename
+    mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
+                           __s, __b, __t, __c, __l, __f>::result_type
+    mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
+                           __s, __b, __t, __c, __l, __f>::
+    operator()()
+    {
+      // Reload the vector - cost is O(n) amortized over n calls.
+      if (_M_p >= state_size)
+       {
+         const _UIntType __upper_mask = (~_UIntType()) << __r;
+         const _UIntType __lower_mask = ~__upper_mask;
+
+         for (size_t __k = 0; __k < (__n - __m); ++__k)
+           {
+             _UIntType __y = ((_M_x[__k] & __upper_mask)
+                              | (_M_x[__k + 1] & __lower_mask));
+             _M_x[__k] = (_M_x[__k + __m] ^ (__y >> 1)
+                          ^ ((__y & 0x01) ? __a : 0));
+           }
+
+         for (size_t __k = (__n - __m); __k < (__n - 1); ++__k)
+           {
+             _UIntType __y = ((_M_x[__k] & __upper_mask)
+                              | (_M_x[__k + 1] & __lower_mask));
+             _M_x[__k] = (_M_x[__k + (__m - __n)] ^ (__y >> 1)
+                          ^ ((__y & 0x01) ? __a : 0));
+           }
+
+         _UIntType __y = ((_M_x[__n - 1] & __upper_mask)
+                          | (_M_x[0] & __lower_mask));
+         _M_x[__n - 1] = (_M_x[__m - 1] ^ (__y >> 1)
+                          ^ ((__y & 0x01) ? __a : 0));
+         _M_p = 0;
+       }
+
+      // Calculate o(x(i)).
+      result_type __z = _M_x[_M_p++];
+      __z ^= (__z >> __u) & __d;
+      __z ^= (__z << __s) & __b;
+      __z ^= (__z << __t) & __c;
+      __z ^= (__z >> __l);
+
+      return __z;
+    }
+
+  template<typename _UIntType, size_t __w,
+          size_t __n, size_t __m, size_t __r,
+          _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+          _UIntType __b, size_t __t, _UIntType __c, size_t __l,
+          _UIntType __f, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const mersenne_twister_engine<_UIntType, __w, __n, __m,
+              __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>& __x)
+    {
+      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;
+      typedef typename __ostream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __os.flags();
+      const _CharT __fill = __os.fill();
+      const _CharT __space = __os.widen(' ');
+      __os.flags(__ios_base::dec
+              | __ios_base::fixed
+              | __ios_base::left);
+      __os.fill(__space);
+
+      for (size_t __i = 0; __i < __n - 1; ++__i)
+       __os << __x._M_x[__i] << __space;
+      __os << __x._M_x[__n - 1];
+
+      __os.flags(__flags);
+      __os.fill(__fill);
+      return __os;
+    }
+
+  template<typename _UIntType, size_t __w,
+          size_t __n, size_t __m, size_t __r,
+          _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+          _UIntType __b, size_t __t, _UIntType __c, size_t __l,
+          _UIntType __f, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              mersenne_twister_engine<_UIntType, __w, __n, __m,
+              __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>& __x)
+    {
+      typedef std::basic_istream<_CharT, _Traits>  __istream_type;
+      typedef typename __istream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __is.flags();
+      __is.flags(__ios_base::dec | __ios_base::skipws);
+
+      for (size_t __i = 0; __i < __n; ++__i)
+       __is >> __x._M_x[__i];
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _UIntType, size_t __w, size_t __s, size_t __r>
+    void
+    subtract_with_carry_engine<_UIntType, __w, __s, __r>::
+    seed(result_type __value)
+    {
+      if (__value == 0)
+       __value = default_seed;
+
+      std::linear_congruential_engine<result_type, 40014U, 0U, 2147483563U>
+       __lcg(__value);
+
+      //  I hope this is right.  The "10000" tests work for the ranluxen.
+      const size_t __n = (word_size + 31) / 32;
+
+      for (size_t __i = 0; __i < long_lag; ++__i)
+       {
+         _UIntType __sum = 0U;
+         _UIntType __factor = 1U;
+         for (size_t __j = 0; __j < __n; ++__j)
+           {
+             __sum += __detail::__mod<__detail::_UInt32Type, 1, 0, 0>
+                        (__lcg()) * __factor;
+             __factor *= __detail::_Shift<_UIntType, 32>::__value;
+           }
+         _M_x[__i] = __detail::__mod<_UIntType, 1, 0, _S_modulus>(__sum);
+       }
+      _M_carry = (_M_x[long_lag - 1] == 0) ? 1 : 0;
+      _M_p = 0;
+    }
+
+  template<typename _UIntType, size_t __w, size_t __s, size_t __r>
+    void
+    subtract_with_carry_engine<_UIntType, __w, __s, __r>::
+    seed(seed_seq& __q)
+    {
+      const size_t __n = (word_size + 31) / 32;
+      unsigned int __arr[long_lag + __n];
+      __q.generate(__arr + 0, __arr + long_lag + __n);
+
+      for (size_t __i = 0; __i < long_lag; ++__i)
+        {
+          _UIntType __sum = 0U;
+          _UIntType __factor = 1U;
+          for (size_t __j = 0; __j < __n; ++__j)
+            {
+             __sum += __detail::__mod<__detail::_UInt32Type, 1, 0, 0>
+                        (__arr[__i * __n + __j]) * __factor;
+             __factor *= __detail::_Shift<_UIntType, 32>::__value;
+            }
+          _M_x[__i] = __detail::__mod<_UIntType, 1, 0, _S_modulus>(__sum);
+        }
+      _M_carry = (_M_x[long_lag - 1] == 0) ? 1 : 0;
+      _M_p = 0;
+    }
+
+  template<typename _UIntType, size_t __w, size_t __s, size_t __r>
+    typename subtract_with_carry_engine<_UIntType, __w, __s, __r>::
+            result_type
+    subtract_with_carry_engine<_UIntType, __w, __s, __r>::
+    operator()()
+    {
+      // Derive short lag index from current index.
+      long __ps = _M_p - short_lag;
+      if (__ps < 0)
+       __ps += long_lag;
+
+      // Calculate new x(i) without overflow or division.
+      // NB: Thanks to the requirements for _UIntType, _M_x[_M_p] + _M_carry
+      // cannot overflow.
+      _UIntType __xi;
+      if (_M_x[__ps] >= _M_x[_M_p] + _M_carry)
+       {
+         __xi = _M_x[__ps] - _M_x[_M_p] - _M_carry;
+         _M_carry = 0;
+       }
+      else
+       {
+         __xi = _S_modulus - _M_x[_M_p] - _M_carry + _M_x[__ps];
+         _M_carry = 1;
+       }
+      _M_x[_M_p] = __xi;
+
+      // Adjust current index to loop around in ring buffer.
+      if (++_M_p >= long_lag)
+       _M_p = 0;
+
+      return __xi;
+    }
+
+  template<typename _UIntType, size_t __w, size_t __s, size_t __r,
+          typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const subtract_with_carry_engine<_UIntType,
+                                               __w, __s, __r>& __x)
+    {
+      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;
+      typedef typename __ostream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __os.flags();
+      const _CharT __fill = __os.fill();
+      const _CharT __space = __os.widen(' ');
+      __os.flags(__ios_base::dec
+              | __ios_base::fixed
+              | __ios_base::left);
+      __os.fill(__space);
+
+      for (size_t __i = 0; __i < __r; ++__i)
+       __os << __x._M_x[__i] << __space;
+      __os << __x._M_carry;
+
+      __os.flags(__flags);
+      __os.fill(__fill);
+      return __os;
+    }
+
+  template<typename _UIntType, size_t __w, size_t __s, size_t __r,
+          typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              subtract_with_carry_engine<_UIntType, __w, __s, __r>& __x)
+    {
+      typedef std::basic_ostream<_CharT, _Traits>  __istream_type;
+      typedef typename __istream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __is.flags();
+      __is.flags(__ios_base::dec | __ios_base::skipws);
+
+      for (size_t __i = 0; __i < __r; ++__i)
+       __is >> __x._M_x[__i];
+      __is >> __x._M_carry;
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _RandomNumberEngine, size_t __p, size_t __r>
+    typename discard_block_engine<_RandomNumberEngine,
+                          __p, __r>::result_type
+    discard_block_engine<_RandomNumberEngine, __p, __r>::
+    operator()()
+    {
+      if (_M_n >= used_block)
+       {
+         _M_b.discard(block_size - _M_n);
+         _M_n = 0;
+       }
+      ++_M_n;
+      return _M_b();
+    }
+
+  template<typename _RandomNumberEngine, size_t __p, size_t __r,
+          typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const discard_block_engine<_RandomNumberEngine,
+              __p, __r>& __x)
+    {
+      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;
+      typedef typename __ostream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __os.flags();
+      const _CharT __fill = __os.fill();
+      const _CharT __space = __os.widen(' ');
+      __os.flags(__ios_base::dec
+              | __ios_base::fixed
+              | __ios_base::left);
+      __os.fill(__space);
+
+      __os << __x.base() << __space << __x._M_n;
+
+      __os.flags(__flags);
+      __os.fill(__fill);
+      return __os;
+    }
+
+  template<typename _RandomNumberEngine, size_t __p, size_t __r,
+          typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              discard_block_engine<_RandomNumberEngine, __p, __r>& __x)
+    {
+      typedef std::basic_istream<_CharT, _Traits>  __istream_type;
+      typedef typename __istream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __is.flags();
+      __is.flags(__ios_base::dec | __ios_base::skipws);
+
+      __is >> __x._M_b >> __x._M_n;
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _RandomNumberEngine, size_t __w, typename _UIntType>
+    typename independent_bits_engine<_RandomNumberEngine, __w, _UIntType>::
+      result_type
+    independent_bits_engine<_RandomNumberEngine, __w, _UIntType>::
+    operator()()
+    {
+      const long double __r = static_cast<long double>(this->max())
+                           - static_cast<long double>(this->min()) + 1.0L;
+      const result_type __m = std::log2l(__r);
+      result_type __n, __n0, __y0, __y1, __s0, __s1;
+      for (size_t __i = 0; __i < 2; ++__i)
+       {
+         __n = (__w + __m - 1) / __m + __i;
+         __n0 = __n - __w % __n;
+         const result_type __w0 = __w / __n;
+         const result_type __w1 = __w0 + 1;
+         __s0 = 1UL << __w0;
+         __s1 = 1UL << __w1;
+         __y0 = __s0 * (__r / __s0);
+         __y1 = __s1 * (__r / __s1);
+         if (__r - __y0 <= __y0 / __n)
+           break;
+       }
+
+      result_type __sum = 0;
+      for (size_t __k = 0; __k < __n0; ++__k)
+       {
+         result_type __u;
+         do
+           __u = _M_b() - this->min();
+         while (__u >= __y0);
+         __sum = __s0 * __sum
+               + __u % __s0;
+       }
+      for (size_t __k = __n0; __k < __n; ++__k)
+       {
+         result_type __u;
+         do
+           __u = _M_b() - this->min();
+         while (__u >= __y1);
+         __sum = __s1 * __sum
+               + __u % __s1;
+       }
+      return __sum;
+    }
+
+
+  template<typename _RandomNumberEngine, size_t __k>
+    typename shuffle_order_engine<_RandomNumberEngine, __k>::result_type
+    shuffle_order_engine<_RandomNumberEngine, __k>::
+    operator()()
+    {
+      size_t __j = (__k * (_M_y - _M_b.min()))
+                / (_M_b.max() - _M_b.min() + 1);
+      _M_y = _M_v[__j];
+      _M_v[__j] = _M_b();
+
+      return _M_y;
+    }
+
+  template<typename _RandomNumberEngine, size_t __k,
+          typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const shuffle_order_engine<_RandomNumberEngine, __k>& __x)
+    {
+      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;
+      typedef typename __ostream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __os.flags();
+      const _CharT __fill = __os.fill();
+      const _CharT __space = __os.widen(' ');
+      __os.flags(__ios_base::dec
+              | __ios_base::fixed
+              | __ios_base::left);
+      __os.fill(__space);
+
+      __os << __x.base();
+      for (size_t __i = 0; __i < __k; ++__i)
+       __os << __space << __x._M_v[__i];
+      __os << __space << __x._M_y;
+
+      __os.flags(__flags);
+      __os.fill(__fill);
+      return __os;
+    }
+
+  template<typename _RandomNumberEngine, size_t __k,
+          typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              shuffle_order_engine<_RandomNumberEngine, __k>& __x)
+    {
+      typedef std::basic_istream<_CharT, _Traits>  __istream_type;
+      typedef typename __istream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __is.flags();
+      __is.flags(__ios_base::dec | __ios_base::skipws);
+
+      __is >> __x._M_b;
+      for (size_t __i = 0; __i < __k; ++__i)
+       __is >> __x._M_v[__i];
+      __is >> __x._M_y;
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _IntType>
+    template<typename _UniformRandomNumberGenerator>
+      typename uniform_int_distribution<_IntType>::result_type
+      uniform_int_distribution<_IntType>::
+      _M_call(_UniformRandomNumberGenerator& __urng,
+             result_type __min, result_type __max, true_type)
+      {
+       // XXX Must be fixed to work well for *arbitrary* __urng.max(),
+       // __urng.min(), __max, __min.  Currently works fine only in the
+       // most common case __urng.max() - __urng.min() >= __max - __min,
+       // with __urng.max() > __urng.min() >= 0.
+       typedef typename __gnu_cxx::__add_unsigned<typename
+         _UniformRandomNumberGenerator::result_type>::__type __urntype;
+       typedef typename __gnu_cxx::__add_unsigned<result_type>::__type
+                                                             __utype;
+       typedef typename __gnu_cxx::__conditional_type<(sizeof(__urntype)
+                                                       > sizeof(__utype)),
+         __urntype, __utype>::__type                         __uctype;
+
+       result_type __ret;
+
+       const __urntype __urnmin = __urng.min();
+       const __urntype __urnmax = __urng.max();
+       const __urntype __urnrange = __urnmax - __urnmin;
+       const __uctype __urange = __max - __min;
+       const __uctype __udenom = (__urnrange <= __urange
+                                  ? 1 : __urnrange / (__urange + 1));
+       do
+         __ret = (__urntype(__urng()) -  __urnmin) / __udenom;
+       while (__ret > __max - __min);
+
+       return __ret + __min;
+      }
+
+  template<typename _IntType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const uniform_int_distribution<_IntType>& __x)
+    {
+      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;
+      typedef typename __ostream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __os.flags();
+      const _CharT __fill = __os.fill();
+      const _CharT __space = __os.widen(' ');
+      __os.flags(__ios_base::scientific | __ios_base::left);
+      __os.fill(__space);
+
+      __os << __x.a() << __space << __x.b();
+
+      __os.flags(__flags);
+      __os.fill(__fill);
+      return __os;
+    }
+
+  template<typename _IntType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              uniform_int_distribution<_IntType>& __x)
+    {
+      typedef std::basic_istream<_CharT, _Traits>  __istream_type;
+      typedef typename __istream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __is.flags();
+      __is.flags(__ios_base::dec | __ios_base::skipws);
+
+      _IntType __a, __b;
+      __is >> __a >> __b;
+      __x.param(typename uniform_int_distribution<_IntType>::
+               param_type(__a, __b));
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const uniform_real_distribution<_RealType>& __x)
+    {
+      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;
+      typedef typename __ostream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __os.flags();
+      const _CharT __fill = __os.fill();
+      const std::streamsize __precision = __os.precision();
+      const _CharT __space = __os.widen(' ');
+      __os.flags(__ios_base::scientific | __ios_base::left);
+      __os.fill(__space);
+      __os.precision(std::numeric_limits<_RealType>::digits10 + 1);
+
+      __os << __x.a() << __space << __x.b();
+
+      __os.flags(__flags);
+      __os.fill(__fill);
+      __os.precision(__precision);
+      return __os;
+    }
+
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              uniform_real_distribution<_RealType>& __x)
+    {
+      typedef std::basic_istream<_CharT, _Traits>  __istream_type;
+      typedef typename __istream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __is.flags();
+      __is.flags(__ios_base::skipws);
+
+      _RealType __a, __b;
+      __is >> __a >> __b;
+      __x.param(typename uniform_real_distribution<_RealType>::
+               param_type(__a, __b));
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const bernoulli_distribution& __x)
+    {
+      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;
+      typedef typename __ostream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __os.flags();
+      const _CharT __fill = __os.fill();
+      const std::streamsize __precision = __os.precision();
+      __os.flags(__ios_base::scientific | __ios_base::left);
+      __os.fill(__os.widen(' '));
+      __os.precision(std::numeric_limits<double>::digits10 + 1);
+
+      __os << __x.p();
+
+      __os.flags(__flags);
+      __os.fill(__fill);
+      __os.precision(__precision);
+      return __os;
+    }
+
+
+  template<typename _IntType>
+    template<typename _UniformRandomNumberGenerator>
+      typename geometric_distribution<_IntType>::result_type
+      geometric_distribution<_IntType>::
+      operator()(_UniformRandomNumberGenerator& __urng,
+                const param_type& __param)
+      {
+       // About the epsilon thing see this thread:
+       // http://gcc.gnu.org/ml/gcc-patches/2006-10/msg00971.html
+       const double __naf =
+         (1 - std::numeric_limits<double>::epsilon()) / 2;
+       // The largest _RealType convertible to _IntType.
+       const double __thr =
+         std::numeric_limits<_IntType>::max() + __naf;
+       __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
+         __aurng(__urng);
+
+       double __cand;
+       do
+         __cand = std::ceil(std::log(__aurng()) / __param._M_log_p);
+       while (__cand >= __thr);
+
+       return result_type(__cand + __naf);
+      }
+
+  template<typename _IntType,
+          typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const geometric_distribution<_IntType>& __x)
+    {
+      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;
+      typedef typename __ostream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __os.flags();
+      const _CharT __fill = __os.fill();
+      const std::streamsize __precision = __os.precision();
+      __os.flags(__ios_base::scientific | __ios_base::left);
+      __os.fill(__os.widen(' '));
+      __os.precision(std::numeric_limits<double>::digits10 + 1);
+
+      __os << __x.p();
+
+      __os.flags(__flags);
+      __os.fill(__fill);
+      __os.precision(__precision);
+      return __os;
+    }
+
+  template<typename _IntType,
+          typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              geometric_distribution<_IntType>& __x)
+    {
+      typedef std::basic_istream<_CharT, _Traits>  __istream_type;
+      typedef typename __istream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __is.flags();
+      __is.flags(__ios_base::skipws);
+
+      double __p;
+      __is >> __p;
+      __x.param(typename geometric_distribution<_IntType>::param_type(__p));
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+  template<typename _IntType>
+    template<typename _UniformRandomNumberGenerator>
+      typename negative_binomial_distribution<_IntType>::result_type
+      negative_binomial_distribution<_IntType>::
+      operator()(_UniformRandomNumberGenerator& __urng,
+                const param_type& __p)
+      {
+       typename gamma_distribution<>::param_type
+         __gamma_param(__p.k(), 1.0);
+       gamma_distribution<> __gamma(__gamma_param);
+       double __x = __gamma(__urng);
+
+       typename poisson_distribution<result_type>::param_type
+         __poisson_param(__x * __p.p() / (1.0 - __p.p()));
+       poisson_distribution<result_type> __poisson(__poisson_param);
+       result_type __m = __poisson(__urng);
+
+       return __m;
+      }
+
+  template<typename _IntType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const negative_binomial_distribution<_IntType>& __x)
+    {
+      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;
+      typedef typename __ostream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __os.flags();
+      const _CharT __fill = __os.fill();
+      const std::streamsize __precision = __os.precision();
+      const _CharT __space = __os.widen(' ');
+      __os.flags(__ios_base::scientific | __ios_base::left);
+      __os.fill(__os.widen(' '));
+      __os.precision(std::numeric_limits<double>::digits10 + 1);
+
+      __os << __x.k() << __space << __x.p();
+
+      __os.flags(__flags);
+      __os.fill(__fill);
+      __os.precision(__precision);
+      return __os;
+    }
+
+  template<typename _IntType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              negative_binomial_distribution<_IntType>& __x)
+    {
+      typedef std::basic_istream<_CharT, _Traits>  __istream_type;
+      typedef typename __istream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __is.flags();
+      __is.flags(__ios_base::skipws);
+
+      _IntType __k;
+      double __p;
+      __is >> __k >> __p;
+      __x.param(typename negative_binomial_distribution<_IntType>::
+               param_type(__k, __p));
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _IntType>
+    void
+    poisson_distribution<_IntType>::param_type::
+    _M_initialize()
+    {
+#if _GLIBCXX_USE_C99_MATH_TR1
+      if (_M_mean >= 12)
+       {
+         const double __m = std::floor(_M_mean);
+         _M_lm_thr = std::log(_M_mean);
+         _M_lfm = std::lgamma(__m + 1);
+         _M_sm = std::sqrt(__m);
+
+         const double __pi_4 = 0.7853981633974483096156608458198757L;
+         const double __dx = std::sqrt(2 * __m * std::log(32 * __m
+                                                             / __pi_4));
+         _M_d = std::round(std::max(6.0, std::min(__m, __dx)));
+         const double __cx = 2 * __m + _M_d;
+         _M_scx = std::sqrt(__cx / 2);
+         _M_1cx = 1 / __cx;
+
+         _M_c2b = std::sqrt(__pi_4 * __cx) * std::exp(_M_1cx);
+         _M_cb = 2 * __cx * std::exp(-_M_d * _M_1cx * (1 + _M_d / 2))
+               / _M_d;
+       }
+      else
+#endif
+       _M_lm_thr = std::exp(-_M_mean);
+      }
+
+  /**
+   * A rejection algorithm when mean >= 12 and a simple method based
+   * upon the multiplication of uniform random variates otherwise.
+   * NB: The former is available only if _GLIBCXX_USE_C99_MATH_TR1
+   * is defined.
+   *
+   * Reference:
+   * Devroye, L. "Non-Uniform Random Variates Generation." Springer-Verlag,
+   * New York, 1986, Ch. X, Sects. 3.3 & 3.4 (+ Errata!).
+   */
+  template<typename _IntType>
+    template<typename _UniformRandomNumberGenerator>
+      typename poisson_distribution<_IntType>::result_type
+      poisson_distribution<_IntType>::
+      operator()(_UniformRandomNumberGenerator& __urng,
+                const param_type& __param)
+      {
+       __detail::_Adaptor<_UniformRandomNumberGenerator, double>
+         __aurng(__urng);
+#if _GLIBCXX_USE_C99_MATH_TR1
+       if (__param.mean() >= 12)
+         {
+           double __x;
+
+           // See comments above...
+           const double __naf =
+             (1 - std::numeric_limits<double>::epsilon()) / 2;
+           const double __thr =
+             std::numeric_limits<_IntType>::max() + __naf;
+
+           const double __m = std::floor(__param.mean());
+           // sqrt(pi / 2)
+           const double __spi_2 = 1.2533141373155002512078826424055226L;
+           const double __c1 = __param._M_sm * __spi_2;
+           const double __c2 = __param._M_c2b + __c1;
+           const double __c3 = __c2 + 1;
+           const double __c4 = __c3 + 1;
+           // e^(1 / 78)
+           const double __e178 = 1.0129030479320018583185514777512983L;
+           const double __c5 = __c4 + __e178;
+           const double __c = __param._M_cb + __c5;
+           const double __2cx = 2 * (2 * __m + __param._M_d);
+
+           bool __reject = true;
+           do
+             {
+               const double __u = __c * __aurng();
+               const double __e = -std::log(__aurng());
+
+               double __w = 0.0;
+
+               if (__u <= __c1)
+                 {
+                   const double __n = _M_nd(__urng);
+                   const double __y = -std::abs(__n) * __param._M_sm - 1;
+                   __x = std::floor(__y);
+                   __w = -__n * __n / 2;
+                   if (__x < -__m)
+                     continue;
+                 }
+               else if (__u <= __c2)
+                 {
+                   const double __n = _M_nd(__urng);
+                   const double __y = 1 + std::abs(__n) * __param._M_scx;
+                   __x = std::ceil(__y);
+                   __w = __y * (2 - __y) * __param._M_1cx;
+                   if (__x > __param._M_d)
+                     continue;
+                 }
+               else if (__u <= __c3)
+                 // NB: This case not in the book, nor in the Errata,
+                 // but should be ok...
+                 __x = -1;
+               else if (__u <= __c4)
+                 __x = 0;
+               else if (__u <= __c5)
+                 __x = 1;
+               else
+                 {
+                   const double __v = -std::log(__aurng());
+                   const double __y = __param._M_d
+                                    + __v * __2cx / __param._M_d;
+                   __x = std::ceil(__y);
+                   __w = -__param._M_d * __param._M_1cx * (1 + __y / 2);
+                 }
+
+               __reject = (__w - __e - __x * __param._M_lm_thr
+                           > __param._M_lfm - std::lgamma(__x + __m + 1));
+
+               __reject |= __x + __m >= __thr;
+
+             } while (__reject);
+
+           return result_type(__x + __m + __naf);
+         }
+       else
+#endif
+         {
+           _IntType     __x = 0;
+           double __prod = 1.0;
+
+           do
+             {
+               __prod *= __aurng();
+               __x += 1;
+             }
+           while (__prod > __param._M_lm_thr);
+
+           return __x - 1;
+         }
+      }
+
+  template<typename _IntType,
+          typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const poisson_distribution<_IntType>& __x)
+    {
+      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;
+      typedef typename __ostream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __os.flags();
+      const _CharT __fill = __os.fill();
+      const std::streamsize __precision = __os.precision();
+      const _CharT __space = __os.widen(' ');
+      __os.flags(__ios_base::scientific | __ios_base::left);
+      __os.fill(__space);
+      __os.precision(std::numeric_limits<double>::digits10 + 1);
+
+      __os << __x.mean() << __space << __x._M_nd;
+
+      __os.flags(__flags);
+      __os.fill(__fill);
+      __os.precision(__precision);
+      return __os;
+    }
+
+  template<typename _IntType,
+          typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              poisson_distribution<_IntType>& __x)
+    {
+      typedef std::basic_istream<_CharT, _Traits>  __istream_type;
+      typedef typename __istream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __is.flags();
+      __is.flags(__ios_base::skipws);
+
+      double __mean;
+      __is >> __mean >> __x._M_nd;
+      __x.param(typename poisson_distribution<_IntType>::param_type(__mean));
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _IntType>
+    void
+    binomial_distribution<_IntType>::param_type::
+    _M_initialize()
+    {
+      const double __p12 = _M_p <= 0.5 ? _M_p : 1.0 - _M_p;
+
+      _M_easy = true;
+
+#if _GLIBCXX_USE_C99_MATH_TR1
+      if (_M_t * __p12 >= 8)
+       {
+         _M_easy = false;
+         const double __np = std::floor(_M_t * __p12);
+         const double __pa = __np / _M_t;
+         const double __1p = 1 - __pa;
+
+         const double __pi_4 = 0.7853981633974483096156608458198757L;
+         const double __d1x =
+           std::sqrt(__np * __1p * std::log(32 * __np
+                                            / (81 * __pi_4 * __1p)));
+         _M_d1 = std::round(std::max(1.0, __d1x));
+         const double __d2x =
+           std::sqrt(__np * __1p * std::log(32 * _M_t * __1p
+                                            / (__pi_4 * __pa)));
+         _M_d2 = std::round(std::max(1.0, __d2x));
+
+         // sqrt(pi / 2)
+         const double __spi_2 = 1.2533141373155002512078826424055226L;
+         _M_s1 = std::sqrt(__np * __1p) * (1 + _M_d1 / (4 * __np));
+         _M_s2 = std::sqrt(__np * __1p) * (1 + _M_d2 / (4 * _M_t * __1p));
+         _M_c = 2 * _M_d1 / __np;
+         _M_a1 = std::exp(_M_c) * _M_s1 * __spi_2;
+         const double __a12 = _M_a1 + _M_s2 * __spi_2;
+         const double __s1s = _M_s1 * _M_s1;
+         _M_a123 = __a12 + (std::exp(_M_d1 / (_M_t * __1p))
+                            * 2 * __s1s / _M_d1
+                            * std::exp(-_M_d1 * _M_d1 / (2 * __s1s)));
+         const double __s2s = _M_s2 * _M_s2;
+         _M_s = (_M_a123 + 2 * __s2s / _M_d2
+                 * std::exp(-_M_d2 * _M_d2 / (2 * __s2s)));
+         _M_lf = (std::lgamma(__np + 1)
+                  + std::lgamma(_M_t - __np + 1));
+         _M_lp1p = std::log(__pa / __1p);
+
+         _M_q = -std::log(1 - (__p12 - __pa) / __1p);
+       }
+      else
+#endif
+       _M_q = -std::log(1 - __p12);
+    }
+
+  template<typename _IntType>
+    template<typename _UniformRandomNumberGenerator>
+      typename binomial_distribution<_IntType>::result_type
+      binomial_distribution<_IntType>::
+      _M_waiting(_UniformRandomNumberGenerator& __urng, _IntType __t)
+      {
+       _IntType __x = 0;
+       double __sum = 0.0;
+       __detail::_Adaptor<_UniformRandomNumberGenerator, double>
+         __aurng(__urng);
+
+       do
+         {
+           const double __e = -std::log(__aurng());
+           __sum += __e / (__t - __x);
+           __x += 1;
+         }
+       while (__sum <= _M_param._M_q);
+
+       return __x - 1;
+      }
+
+  /**
+   * A rejection algorithm when t * p >= 8 and a simple waiting time
+   * method - the second in the referenced book - otherwise.
+   * NB: The former is available only if _GLIBCXX_USE_C99_MATH_TR1
+   * is defined.
+   *
+   * Reference:
+   * Devroye, L. "Non-Uniform Random Variates Generation." Springer-Verlag,
+   * New York, 1986, Ch. X, Sect. 4 (+ Errata!).
+   */
+  template<typename _IntType>
+    template<typename _UniformRandomNumberGenerator>
+      typename binomial_distribution<_IntType>::result_type
+      binomial_distribution<_IntType>::
+      operator()(_UniformRandomNumberGenerator& __urng,
+                const param_type& __param)
+      {
+       result_type __ret;
+       const _IntType __t = __param.t();
+       const _IntType __p = __param.p();
+       const double __p12 = __p <= 0.5 ? __p : 1.0 - __p;
+       __detail::_Adaptor<_UniformRandomNumberGenerator, double>
+         __aurng(__urng);
+
+#if _GLIBCXX_USE_C99_MATH_TR1
+       if (!__param._M_easy)
+         {
+           double __x;
+
+           // See comments above...
+           const double __naf =
+             (1 - std::numeric_limits<double>::epsilon()) / 2;
+           const double __thr =
+             std::numeric_limits<_IntType>::max() + __naf;
+
+           const double __np = std::floor(__t * __p12);
+
+           // sqrt(pi / 2)
+           const double __spi_2 = 1.2533141373155002512078826424055226L;
+           const double __a1 = __param._M_a1;
+           const double __a12 = __a1 + __param._M_s2 * __spi_2;
+           const double __a123 = __param._M_a123;
+           const double __s1s = __param._M_s1 * __param._M_s1;
+           const double __s2s = __param._M_s2 * __param._M_s2;
+
+           bool __reject;
+           do
+             {
+               const double __u = __param._M_s * __aurng();
+
+               double __v;
+
+               if (__u <= __a1)
+                 {
+                   const double __n = _M_nd(__urng);
+                   const double __y = __param._M_s1 * std::abs(__n);
+                   __reject = __y >= __param._M_d1;
+                   if (!__reject)
+                     {
+                       const double __e = -std::log(__aurng());
+                       __x = std::floor(__y);
+                       __v = -__e - __n * __n / 2 + __param._M_c;
+                     }
+                 }
+               else if (__u <= __a12)
+                 {
+                   const double __n = _M_nd(__urng);
+                   const double __y = __param._M_s2 * std::abs(__n);
+                   __reject = __y >= __param._M_d2;
+                   if (!__reject)
+                     {
+                       const double __e = -std::log(__aurng());
+                       __x = std::floor(-__y);
+                       __v = -__e - __n * __n / 2;
+                     }
+                 }
+               else if (__u <= __a123)
+                 {
+                   const double __e1 = -std::log(__aurng());
+                   const double __e2 = -std::log(__aurng());
+
+                   const double __y = __param._M_d1
+                                    + 2 * __s1s * __e1 / __param._M_d1;
+                   __x = std::floor(__y);
+                   __v = (-__e2 + __param._M_d1 * (1 / (__t - __np)
+                                                   -__y / (2 * __s1s)));
+                   __reject = false;
+                 }
+               else
+                 {
+                   const double __e1 = -std::log(__aurng());
+                   const double __e2 = -std::log(__aurng());
+
+                   const double __y = __param._M_d2
+                                    + 2 * __s2s * __e1 / __param._M_d2;
+                   __x = std::floor(-__y);
+                   __v = -__e2 - __param._M_d2 * __y / (2 * __s2s);
+                   __reject = false;
+                 }
+
+               __reject = __reject || __x < -__np || __x > __t - __np;
+               if (!__reject)
+                 {
+                   const double __lfx =
+                     std::lgamma(__np + __x + 1)
+                     + std::lgamma(__t - (__np + __x) + 1);
+                   __reject = __v > __param._M_lf - __lfx
+                            + __x * __param._M_lp1p;
+                 }
+
+               __reject |= __x + __np >= __thr;
+             }
+           while (__reject);
+
+           __x += __np + __naf;
+
+           const _IntType __z = _M_waiting(__urng, __t - _IntType(__x));
+           __ret = _IntType(__x) + __z;
+         }
+       else
+#endif
+         __ret = _M_waiting(__urng, __t);
+
+       if (__p12 != __p)
+         __ret = __t - __ret;
+       return __ret;
+      }
+
+  template<typename _IntType,
+          typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const binomial_distribution<_IntType>& __x)
+    {
+      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;
+      typedef typename __ostream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __os.flags();
+      const _CharT __fill = __os.fill();
+      const std::streamsize __precision = __os.precision();
+      const _CharT __space = __os.widen(' ');
+      __os.flags(__ios_base::scientific | __ios_base::left);
+      __os.fill(__space);
+      __os.precision(std::numeric_limits<double>::digits10 + 1);
+
+      __os << __x.t() << __space << __x.p()
+          << __space << __x._M_nd;
+
+      __os.flags(__flags);
+      __os.fill(__fill);
+      __os.precision(__precision);
+      return __os;
+    }
+
+  template<typename _IntType,
+          typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              binomial_distribution<_IntType>& __x)
+    {
+      typedef std::basic_istream<_CharT, _Traits>  __istream_type;
+      typedef typename __istream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __is.flags();
+      __is.flags(__ios_base::dec | __ios_base::skipws);
+
+      _IntType __t;
+      double __p;
+      __is >> __t >> __p >> __x._M_nd;
+      __x.param(typename binomial_distribution<_IntType>::
+               param_type(__t, __p));
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const exponential_distribution<_RealType>& __x)
+    {
+      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;
+      typedef typename __ostream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __os.flags();
+      const _CharT __fill = __os.fill();
+      const std::streamsize __precision = __os.precision();
+      __os.flags(__ios_base::scientific | __ios_base::left);
+      __os.fill(__os.widen(' '));
+      __os.precision(std::numeric_limits<_RealType>::digits10 + 1);
+
+      __os << __x.lambda();
+
+      __os.flags(__flags);
+      __os.fill(__fill);
+      __os.precision(__precision);
+      return __os;
+    }
+
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              exponential_distribution<_RealType>& __x)
+    {
+      typedef std::basic_istream<_CharT, _Traits>  __istream_type;
+      typedef typename __istream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __is.flags();
+      __is.flags(__ios_base::dec | __ios_base::skipws);
+
+      _RealType __lambda;
+      __is >> __lambda;
+      __x.param(typename exponential_distribution<_RealType>::
+               param_type(__lambda));
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _RealType>
+    bool
+    operator==(const normal_distribution<_RealType>& __d1,
+              const normal_distribution<_RealType>& __d2)
+    {
+      if (__d1._M_param == __d2._M_param)
+       {
+         if (__d1._M_saved_available == __d2._M_saved_available)
+           {
+             if (__d1._M_saved_available
+              && __d1._M_saved == __d2._M_saved)
+               return true;
+             else if(!__d1._M_saved_available)
+               return true;
+             else
+               return false;
+           }
+         else
+           return false;
+       }
+      else
+       return false;
+    }
+
+  /**
+   * Polar method due to Marsaglia.
+   *
+   * Devroye, L. "Non-Uniform Random Variates Generation." Springer-Verlag,
+   * New York, 1986, Ch. V, Sect. 4.4.
+   */
+  template<typename _RealType>
+    template<typename _UniformRandomNumberGenerator>
+      typename normal_distribution<_RealType>::result_type
+      normal_distribution<_RealType>::
+      operator()(_UniformRandomNumberGenerator& __urng,
+                const param_type& __param)
+      {
+       result_type __ret;
+       __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
+         __aurng(__urng);
+
+       if (_M_saved_available)
+         {
+           _M_saved_available = false;
+           __ret = _M_saved;
+         }
+       else
+         {
+           result_type __x, __y, __r2;
+           do
+             {
+               __x = result_type(2.0) * __aurng() - 1.0;
+               __y = result_type(2.0) * __aurng() - 1.0;
+               __r2 = __x * __x + __y * __y;
+             }
+           while (__r2 > 1.0 || __r2 == 0.0);
+
+           const result_type __mult = std::sqrt(-2 * std::log(__r2) / __r2);
+           _M_saved = __x * __mult;
+           _M_saved_available = true;
+           __ret = __y * __mult;
+         }
+
+       __ret = __ret * __param.stddev() + __param.mean();
+       return __ret;
+      }
+
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const normal_distribution<_RealType>& __x)
+    {
+      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;
+      typedef typename __ostream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __os.flags();
+      const _CharT __fill = __os.fill();
+      const std::streamsize __precision = __os.precision();
+      const _CharT __space = __os.widen(' ');
+      __os.flags(__ios_base::scientific | __ios_base::left);
+      __os.fill(__space);
+      __os.precision(std::numeric_limits<_RealType>::digits10 + 1);
+
+      __os << __x.mean() << __space << __x.stddev()
+          << __space << __x._M_saved_available;
+      if (__x._M_saved_available)
+       __os << __space << __x._M_saved;
+
+      __os.flags(__flags);
+      __os.fill(__fill);
+      __os.precision(__precision);
+      return __os;
+    }
+
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              normal_distribution<_RealType>& __x)
+    {
+      typedef std::basic_istream<_CharT, _Traits>  __istream_type;
+      typedef typename __istream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __is.flags();
+      __is.flags(__ios_base::dec | __ios_base::skipws);
+
+      double __mean, __stddev;
+      __is >> __mean >> __stddev
+          >> __x._M_saved_available;
+      if (__x._M_saved_available)
+       __is >> __x._M_saved;
+      __x.param(typename normal_distribution<_RealType>::
+               param_type(__mean, __stddev));
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _RealType>
+    template<typename _UniformRandomNumberGenerator>
+      typename lognormal_distribution<_RealType>::result_type
+      lognormal_distribution<_RealType>::
+      operator()(_UniformRandomNumberGenerator& __urng,
+                const param_type& __p)
+      {
+       _RealType __u, __v, __r2, __normal;
+       __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
+         __aurng(__urng);
+
+       do
+         {
+           // Choose x,y in uniform square (-1,-1) to (+1,+1).
+           __u = 2 * __aurng() - 1;
+           __v = 2 * __aurng() - 1;
+
+           // See if it is in the unit circle.
+           __r2 = __u * __u + __v * __v;
+         }
+       while (__r2 > 1 || __r2 == 0);
+
+       __normal = __u * std::sqrt(-2 * std::log(__r2) / __r2);
+
+       return std::exp(__p.s() * __normal + __p.m());
+      }
+
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const lognormal_distribution<_RealType>& __x)
+    {
+      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;
+      typedef typename __ostream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __os.flags();
+      const _CharT __fill = __os.fill();
+      const std::streamsize __precision = __os.precision();
+      const _CharT __space = __os.widen(' ');
+      __os.flags(__ios_base::scientific | __ios_base::left);
+      __os.fill(__space);
+      __os.precision(std::numeric_limits<_RealType>::digits10 + 1);
+
+      __os << __x.m() << __space << __x.s();
+
+      __os.flags(__flags);
+      __os.fill(__fill);
+      __os.precision(__precision);
+      return __os;
+    }
+
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              lognormal_distribution<_RealType>& __x)
+    {
+      typedef std::basic_istream<_CharT, _Traits>  __istream_type;
+      typedef typename __istream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __is.flags();
+      __is.flags(__ios_base::dec | __ios_base::skipws);
+
+      _RealType __m, __s;
+      __is >> __m >> __s;
+      __x.param(typename lognormal_distribution<_RealType>::
+               param_type(__m, __s));
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _RealType>
+    template<typename _UniformRandomNumberGenerator>
+      typename chi_squared_distribution<_RealType>::result_type
+      chi_squared_distribution<_RealType>::
+      operator()(_UniformRandomNumberGenerator& __urng,
+                const param_type& __p)
+      {
+       typename gamma_distribution<_RealType>::param_type
+         __gamma_param(__p.n() / 2, 1.0);
+       gamma_distribution<_RealType> __gamma(__gamma_param);
+       return 2 * __gamma(__urng);
+      }
+
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const chi_squared_distribution<_RealType>& __x)
+    {
+      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;
+      typedef typename __ostream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __os.flags();
+      const _CharT __fill = __os.fill();
+      const std::streamsize __precision = __os.precision();
+      const _CharT __space = __os.widen(' ');
+      __os.flags(__ios_base::scientific | __ios_base::left);
+      __os.fill(__space);
+      __os.precision(std::numeric_limits<_RealType>::digits10 + 1);
+
+      __os << __x.n();
+
+      __os.flags(__flags);
+      __os.fill(__fill);
+      __os.precision(__precision);
+      return __os;
+    }
+
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              chi_squared_distribution<_RealType>& __x)
+    {
+      typedef std::basic_istream<_CharT, _Traits>  __istream_type;
+      typedef typename __istream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __is.flags();
+      __is.flags(__ios_base::dec | __ios_base::skipws);
+
+      _RealType __n;
+      __is >> __n;
+      __x.param(typename chi_squared_distribution<_RealType>::
+               param_type(__n));
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _RealType>
+    template<typename _UniformRandomNumberGenerator>
+      typename cauchy_distribution<_RealType>::result_type
+      cauchy_distribution<_RealType>::
+      operator()(_UniformRandomNumberGenerator& __urng,
+                const param_type& __p)
+      {
+       __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
+         __aurng(__urng);
+       _RealType __u;
+       do
+         {
+           __u = __aurng();
+         }
+       while (__u == 0.5);
+
+       return __p.a() + __p.b() * std::tan(M_PI * __u);
+      }
+
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const cauchy_distribution<_RealType>& __x)
+    {
+      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;
+      typedef typename __ostream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __os.flags();
+      const _CharT __fill = __os.fill();
+      const std::streamsize __precision = __os.precision();
+      const _CharT __space = __os.widen(' ');
+      __os.flags(__ios_base::scientific | __ios_base::left);
+      __os.fill(__space);
+      __os.precision(std::numeric_limits<_RealType>::digits10 + 1);
+
+      __os << __x.a() << __space << __x.b();
+
+      __os.flags(__flags);
+      __os.fill(__fill);
+      __os.precision(__precision);
+      return __os;
+    }
+
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              cauchy_distribution<_RealType>& __x)
+    {
+      typedef std::basic_istream<_CharT, _Traits>  __istream_type;
+      typedef typename __istream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __is.flags();
+      __is.flags(__ios_base::dec | __ios_base::skipws);
+
+      _RealType __a, __b;
+      __is >> __a >> __b;
+      __x.param(typename cauchy_distribution<_RealType>::
+               param_type(__a, __b));
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _RealType>
+    template<typename _UniformRandomNumberGenerator>
+      typename fisher_f_distribution<_RealType>::result_type
+      fisher_f_distribution<_RealType>::
+      operator()(_UniformRandomNumberGenerator& __urng,
+                const param_type& __p)
+      {
+       gamma_distribution<_RealType> __gamma;
+       _RealType __ym = __gamma(__urng,
+        typename gamma_distribution<_RealType>::param_type(__p.m() / 2, 2));
+
+       _RealType __yn = __gamma(__urng,
+        typename gamma_distribution<_RealType>::param_type(__p.n() / 2, 2));
+
+       return (__ym * __p.n()) / (__yn * __p.m());
+      }
+
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const fisher_f_distribution<_RealType>& __x)
+    {
+      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;
+      typedef typename __ostream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __os.flags();
+      const _CharT __fill = __os.fill();
+      const std::streamsize __precision = __os.precision();
+      const _CharT __space = __os.widen(' ');
+      __os.flags(__ios_base::scientific | __ios_base::left);
+      __os.fill(__space);
+      __os.precision(std::numeric_limits<_RealType>::digits10 + 1);
+
+      __os << __x.m() << __space << __x.n();
+
+      __os.flags(__flags);
+      __os.fill(__fill);
+      __os.precision(__precision);
+      return __os;
+    }
+
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              fisher_f_distribution<_RealType>& __x)
+    {
+      typedef std::basic_istream<_CharT, _Traits>  __istream_type;
+      typedef typename __istream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __is.flags();
+      __is.flags(__ios_base::dec | __ios_base::skipws);
+
+      _RealType __m, __n;
+      __is >> __m >> __n;
+      __x.param(typename fisher_f_distribution<_RealType>::
+               param_type(__m, __n));
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  //
+  //  This could be operator() for a Gaussian distribution.
+  //
+  template<typename _RealType>
+    template<typename _UniformRandomNumberGenerator>
+      typename student_t_distribution<_RealType>::result_type
+      student_t_distribution<_RealType>::
+      _M_gaussian(_UniformRandomNumberGenerator& __urng,
+                 const result_type __sigma)
+      {
+       _RealType __x, __y, __r2;
+       __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
+         __aurng(__urng);
+
+       do
+         {
+           // Choose x,y in uniform square (-1,-1) to (+1,+1).
+           __x = 2 * __aurng() - 1;
+           __y = 2 * __aurng() - 1;
+
+           // See if it is in the unit circle.
+           __r2 = __x * __x + __y * __y;
+         }
+       while (__r2 > 1 || __r2 == 0);
+
+       // Box-Muller transform.
+       return __sigma * __y * std::sqrt(-2 * std::log(__r2) / __r2);
+      }
+
+  template<typename _RealType>
+    template<typename _UniformRandomNumberGenerator>
+      typename student_t_distribution<_RealType>::result_type
+      student_t_distribution<_RealType>::
+      operator()(_UniformRandomNumberGenerator& __urng,
+                const param_type& __param)
+      {
+       if (__param.n() <= 2.0)
+         {
+           _RealType __y1 = _M_gaussian(__urng, 1.0);
+           typename chi_squared_distribution<_RealType>::param_type
+             __chisq_param(__param.n());
+           chi_squared_distribution<_RealType> __chisq(__chisq_param);
+           _RealType __y2 = __chisq(__urng);
+
+           return __y1 / std::sqrt(__y2 / __param.n());
+         }
+       else
+         {
+           _RealType __y1, __y2, __z;
+           do
+             {
+               __y1 = _M_gaussian(__urng, 1.0);
+               typename exponential_distribution<_RealType>::param_type
+                 __exp_param(1.0 / (__param.n() / 2.0 - 1.0));
+               exponential_distribution<_RealType>
+                 __exponential(__exp_param);
+               __y2 = __exponential(__urng);
+
+               __z = __y1 * __y1 / (__param.n() - 2.0);
+             }
+           while (1.0 - __z < 0.0 || std::exp(-__y2 - __z) > (1.0 - __z));
+
+           // Note that there is a typo in Knuth's formula, the line below
+           // is taken from the original paper of Marsaglia, Mathematics of
+           // Computation, 34 (1980), p 234-256
+           return __y1 / std::sqrt((1.0 - 2.0 / __param.n()) * (1.0 - __z));
+         }
+      }
+
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const student_t_distribution<_RealType>& __x)
+    {
+      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;
+      typedef typename __ostream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __os.flags();
+      const _CharT __fill = __os.fill();
+      const std::streamsize __precision = __os.precision();
+      const _CharT __space = __os.widen(' ');
+      __os.flags(__ios_base::scientific | __ios_base::left);
+      __os.fill(__space);
+      __os.precision(std::numeric_limits<_RealType>::digits10 + 1);
+
+      __os << __x.n();
+
+      __os.flags(__flags);
+      __os.fill(__fill);
+      __os.precision(__precision);
+      return __os;
+    }
+
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              student_t_distribution<_RealType>& __x)
+    {
+      typedef std::basic_istream<_CharT, _Traits>  __istream_type;
+      typedef typename __istream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __is.flags();
+      __is.flags(__ios_base::dec | __ios_base::skipws);
+
+      _RealType __n;
+      __is >> __n;
+      __x.param(typename student_t_distribution<_RealType>::param_type(__n));
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _RealType>
+    void
+    gamma_distribution<_RealType>::param_type::
+    _M_initialize()
+    {
+      if (_M_alpha >= 1)
+       _M_l_d = std::sqrt(2 * _M_alpha - 1);
+      else
+       _M_l_d = (std::pow(_M_alpha, _M_alpha / (1 - _M_alpha))
+                 * (1 - _M_alpha));
+    }
+
+  /**
+   * Cheng's rejection algorithm GB for alpha >= 1 and a modification
+   * of Vaduva's rejection from Weibull algorithm due to Devroye for
+   * alpha < 1.
+   *
+   * References:
+   * Cheng, R. C. "The Generation of Gamma Random Variables with Non-integral
+   * Shape Parameter." Applied Statistics, 26, 71-75, 1977.
+   *
+   * Vaduva, I. "Computer Generation of Gamma Gandom Variables by Rejection
+   * and Composition Procedures." Math. Operationsforschung and Statistik,
+   * Series in Statistics, 8, 545-576, 1977.
+   *
+   * Devroye, L. "Non-Uniform Random Variates Generation." Springer-Verlag,
+   * New York, 1986, Ch. IX, Sect. 3.4 (+ Errata!).
+   */
+  template<typename _RealType>
+    template<typename _UniformRandomNumberGenerator>
+      typename gamma_distribution<_RealType>::result_type
+      gamma_distribution<_RealType>::
+      operator()(_UniformRandomNumberGenerator& __urng,
+                const param_type& __param)
+      {
+       result_type __x;
+       __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
+         __aurng(__urng);
+
+       bool __reject;
+       const _RealType __alpha = __param.alpha();
+       const _RealType __beta = __param.beta();
+       if (__alpha >= 1)
+         {
+           // alpha - log(4)
+           const result_type __b = __alpha
+             - result_type(1.3862943611198906188344642429163531L);
+           const result_type __c = __alpha + __param._M_l_d;
+           const result_type __1l = 1 / __param._M_l_d;
+
+           // 1 + log(9 / 2)
+           const result_type __k = 2.5040773967762740733732583523868748L;
+
+           do
+             {
+               const result_type __u = __aurng() / __beta;
+               const result_type __v = __aurng() / __beta;
+
+               const result_type __y = __1l * std::log(__v / (1 - __v));
+               __x = __alpha * std::exp(__y);
+
+               const result_type __z = __u * __v * __v;
+               const result_type __r = __b + __c * __y - __x;
+
+               __reject = __r < result_type(4.5) * __z - __k;
+               if (__reject)
+                 __reject = __r < std::log(__z);
+             }
+           while (__reject);
+         }
+       else
+         {
+           const result_type __c = 1 / __alpha;
+
+           do
+             {
+               const result_type __z = -std::log(__aurng() / __beta);
+               const result_type __e = -std::log(__aurng() / __beta);
+
+               __x = std::pow(__z, __c);
+
+               __reject = __z + __e < __param._M_l_d + __x;
+             }
+           while (__reject);
+         }
+
+       return __beta * __x;
+      }
+
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const gamma_distribution<_RealType>& __x)
+    {
+      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;
+      typedef typename __ostream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __os.flags();
+      const _CharT __fill = __os.fill();
+      const std::streamsize __precision = __os.precision();
+      const _CharT __space = __os.widen(' ');
+      __os.flags(__ios_base::scientific | __ios_base::left);
+      __os.fill(__space);
+      __os.precision(std::numeric_limits<_RealType>::digits10 + 1);
+
+      __os << __x.alpha() << __space << __x.beta();
+
+      __os.flags(__flags);
+      __os.fill(__fill);
+      __os.precision(__precision);
+      return __os;
+    }
+
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              gamma_distribution<_RealType>& __x)
+    {
+      typedef std::basic_istream<_CharT, _Traits>  __istream_type;
+      typedef typename __istream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __is.flags();
+      __is.flags(__ios_base::dec | __ios_base::skipws);
+
+      _RealType __alpha, __beta;
+      __is >> __alpha >> __beta;
+      __x.param(typename gamma_distribution<_RealType>::
+               param_type(__alpha, __beta));
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const weibull_distribution<_RealType>& __x)
+    {
+      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;
+      typedef typename __ostream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __os.flags();
+      const _CharT __fill = __os.fill();
+      const std::streamsize __precision = __os.precision();
+      const _CharT __space = __os.widen(' ');
+      __os.flags(__ios_base::scientific | __ios_base::left);
+      __os.fill(__space);
+      __os.precision(std::numeric_limits<_RealType>::digits10 + 1);
+
+      __os << __x.a() << __space << __x.b();
+
+      __os.flags(__flags);
+      __os.fill(__fill);
+      __os.precision(__precision);
+      return __os;
+    }
+
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              weibull_distribution<_RealType>& __x)
+    {
+      typedef std::basic_istream<_CharT, _Traits>  __istream_type;
+      typedef typename __istream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __is.flags();
+      __is.flags(__ios_base::dec | __ios_base::skipws);
+
+      _RealType __a, __b;
+      __is >> __a >> __b;
+      __x.param(typename weibull_distribution<_RealType>::
+               param_type(__a, __b));
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _RealType>
+    template<typename _UniformRandomNumberGenerator>
+      typename extreme_value_distribution<_RealType>::result_type
+      extreme_value_distribution<_RealType>::
+      operator()(_UniformRandomNumberGenerator& __urng,
+                const param_type& __p)
+      {
+       __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
+         __aurng(__urng);
+       return __p.a() - __p.b() * std::log(-std::log(__aurng()));
+      }
+
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const extreme_value_distribution<_RealType>& __x)
+    {
+      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;
+      typedef typename __ostream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __os.flags();
+      const _CharT __fill = __os.fill();
+      const std::streamsize __precision = __os.precision();
+      const _CharT __space = __os.widen(' ');
+      __os.flags(__ios_base::scientific | __ios_base::left);
+      __os.fill(__space);
+      __os.precision(std::numeric_limits<_RealType>::digits10 + 1);
+
+      __os << __x.a() << __space << __x.b();
+
+      __os.flags(__flags);
+      __os.fill(__fill);
+      __os.precision(__precision);
+      return __os;
+    }
+
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              extreme_value_distribution<_RealType>& __x)
+    {
+      typedef std::basic_istream<_CharT, _Traits>  __istream_type;
+      typedef typename __istream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __is.flags();
+      __is.flags(__ios_base::dec | __ios_base::skipws);
+
+      _RealType __a, __b;
+      __is >> __a >> __b;
+      __x.param(typename extreme_value_distribution<_RealType>::
+               param_type(__a, __b));
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _IntType>
+    void
+    discrete_distribution<_IntType>::param_type::
+    _M_initialize()
+    {
+      if (_M_prob.size() < 2)
+       {
+         _M_prob.clear();
+         _M_prob.push_back(1.0);
+         return;
+       }
+
+      double __sum = std::accumulate(_M_prob.begin(), _M_prob.end(), 0.0);
+      //  Now normalize the densities.
+      std::transform(_M_prob.begin(), _M_prob.end(), _M_prob.begin(),
+                    std::bind2nd(std::divides<double>(), __sum));
+      //  Accumulate partial sums.
+      std::partial_sum(_M_prob.begin(), _M_prob.end(),
+                      std::back_inserter(_M_cp));
+      //  Make sure the last cumulative probablility is one.
+      _M_cp[_M_cp.size() - 1] = 1.0;
+    }
+
+  template<typename _IntType>
+    template<typename _Func>
+      discrete_distribution<_IntType>::param_type::
+      param_type(size_t __nw, double __xmin, double __xmax,
+                _Func __fw)
+      : _M_prob(), _M_cp()
+      {
+       for (size_t __i = 0; __i < __nw; ++__i)
+         {
+           const double __x = ((__nw - __i - 0.5) * __xmin
+                                    + (__i + 0.5) * __xmax) / __nw;
+           _M_prob.push_back(__fw(__x));
+         }
+
+       _M_initialize();
+      }
+
+  template<typename _IntType>
+    template<typename _UniformRandomNumberGenerator>
+      typename discrete_distribution<_IntType>::result_type
+      discrete_distribution<_IntType>::
+      operator()(_UniformRandomNumberGenerator& __urng,
+                const param_type& __param)
+      {
+       __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
+         __aurng(__urng);
+
+       const double __p = __aurng();
+       auto __pos = std::lower_bound(__param._M_cp.begin(),
+                                     __param._M_cp.end(), __p);
+       if (__pos == __param._M_cp.end())
+         return 0;
+       const size_t __i = __pos - __param._M_cp.begin();
+
+       return __i;
+      }
+
+  template<typename _IntType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const discrete_distribution<_IntType>& __x)
+    {
+      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;
+      typedef typename __ostream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __os.flags();
+      const _CharT __fill = __os.fill();
+      const std::streamsize __precision = __os.precision();
+      const _CharT __space = __os.widen(' ');
+      __os.flags(__ios_base::scientific | __ios_base::left);
+      __os.fill(__space);
+      __os.precision(std::numeric_limits<double>::digits10 + 1);
+
+      std::vector<double> __prob = __x.probabilities();
+      __os << __prob.size();
+      for (auto __dit = __prob.begin(); __dit != __prob.end(); ++__dit)
+       __os << __space << *__dit;
+
+      __os.flags(__flags);
+      __os.fill(__fill);
+      __os.precision(__precision);
+      return __os;
+    }
+
+  template<typename _IntType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              discrete_distribution<_IntType>& __x)
+    {
+      typedef std::basic_istream<_CharT, _Traits>  __istream_type;
+      typedef typename __istream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __is.flags();
+      __is.flags(__ios_base::dec | __ios_base::skipws);
+
+      size_t __n;
+      __is >> __n;
+
+      std::vector<double> __prob_vec;
+      for (; __n != 0; --__n)
+       {
+         double __prob;
+         __is >> __prob;
+         __prob_vec.push_back(__prob);
+       }
+
+      __x.param(typename discrete_distribution<_IntType>::
+               param_type(__prob_vec.begin(), __prob_vec.end()));
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _RealType>
+    void
+    piecewise_constant_distribution<_RealType>::param_type::
+    _M_initialize()
+    {
+      if (_M_int.size() < 2)
+       {
+         _M_int.clear();
+         _M_int.push_back(_RealType(0));
+         _M_int.push_back(_RealType(1));
+
+         _M_den.clear();
+         _M_den.push_back(1.0);
+
+         return;
+       }
+
+      double __sum = 0.0;
+      for (size_t __i = 0; __i < _M_den.size(); ++__i)
+       {
+         __sum += _M_den[__i] * (_M_int[__i + 1] - _M_int[__i]);
+         _M_cp.push_back(__sum);
+       }
+
+      //  Now normalize the densities...
+      std::transform(_M_den.begin(), _M_den.end(), _M_den.begin(),
+                    std::bind2nd(std::divides<double>(), __sum));
+      //  ... and partial sums.
+      std::transform(_M_cp.begin(), _M_cp.end(), _M_cp.begin(),
+                    std::bind2nd(std::divides<double>(), __sum));
+      //  Make sure the last cumulative probablility is one.
+      _M_cp[_M_cp.size() - 1] = 1.0;
+    }
+
+  template<typename _RealType>
+    piecewise_constant_distribution<_RealType>::param_type::
+    param_type()
+    : _M_int(), _M_den(), _M_cp()
+    {
+      _M_initialize();
+    }
+
+  template<typename _RealType>
+    template<typename _InputIteratorB, typename _InputIteratorW>
+      piecewise_constant_distribution<_RealType>::param_type::
+      param_type(_InputIteratorB __bbegin,
+                _InputIteratorB __bend,
+                _InputIteratorW __wbegin)
+      : _M_int(), _M_den(), _M_cp()
+      {
+       do
+         {
+           _M_int.push_back(*__bbegin);
+           ++__bbegin;
+           if (__bbegin != __bend)
+             {
+               _M_den.push_back(*__wbegin);
+               ++__wbegin;
+             }
+         }
+       while (__bbegin != __bend);
+
+       _M_initialize();
+      }
+
+  template<typename _RealType>
+    template<typename _Func>
+      piecewise_constant_distribution<_RealType>::param_type::
+      param_type(initializer_list<_RealType> __bil, _Func __fw)
+      : _M_int(), _M_den(), _M_cp()
+      {
+       for (auto __biter = __bil.begin(); __biter != __bil.end(); ++__biter)
+         _M_int.push_back(*__biter);
+
+       for (size_t __i = 0; __i < _M_int.size() - 1; ++__i)
+         {
+           _RealType __x = 0.5 * (_M_int[__i] + _M_int[__i + 1]);
+           _M_den.push_back(__fw(__x));
+         }
+
+       _M_initialize();
+      }
+
+  template<typename _RealType>
+    template<typename _Func>
+      piecewise_constant_distribution<_RealType>::param_type::
+      param_type(size_t __nw, _RealType __xmin, _RealType __xmax,
+                _Func __fw)
+      : _M_int(), _M_den(), _M_cp()
+      {
+       for (size_t __i = 0; __i <= __nw; ++__i)
+         {
+           const _RealType __x = ((__nw - __i) * __xmin
+                                         + __i * __xmax) / __nw;
+           _M_int.push_back(__x);
+         }
+       for (size_t __i = 0; __i < __nw; ++__i)
+         {
+           const _RealType __x = ((__nw - __i - 0.5) * __xmin
+                                       + (__i + 0.5) * __xmax) / __nw;
+           _M_den.push_back(__fw(__x));
+         }
+
+       _M_initialize();
+      }
+
+  template<typename _RealType>
+    template<typename _UniformRandomNumberGenerator>
+      typename piecewise_constant_distribution<_RealType>::result_type
+      piecewise_constant_distribution<_RealType>::
+      operator()(_UniformRandomNumberGenerator& __urng,
+                const param_type& __param)
+      {
+       __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
+         __aurng(__urng);
+
+       const double __p = __aurng();
+       auto __pos = std::lower_bound(__param._M_cp.begin(),
+                                     __param._M_cp.end(), __p);
+       const size_t __i = __pos - __param._M_cp.begin();
+
+       return __param._M_int[__i]
+            + (__p - __param._M_cp[__i]) / __param._M_den[__i];
+      }
+
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const piecewise_constant_distribution<_RealType>& __x)
+    {
+      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;
+      typedef typename __ostream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __os.flags();
+      const _CharT __fill = __os.fill();
+      const std::streamsize __precision = __os.precision();
+      const _CharT __space = __os.widen(' ');
+      __os.flags(__ios_base::scientific | __ios_base::left);
+      __os.fill(__space);
+      __os.precision(std::numeric_limits<_RealType>::digits10 + 1);
+
+      std::vector<_RealType> __int = __x.intervals();
+      __os << __int.size() - 1;
+
+      for (auto __xit = __int.begin(); __xit != __int.end(); ++__xit)
+       __os << __space << *__xit;
+
+      std::vector<double> __den = __x.densities();
+      for (auto __dit = __den.begin(); __dit != __den.end(); ++__dit)
+       __os << __space << *__dit;
+
+      __os.flags(__flags);
+      __os.fill(__fill);
+      __os.precision(__precision);
+      return __os;
+    }
+
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              piecewise_constant_distribution<_RealType>& __x)
+    {
+      typedef std::basic_istream<_CharT, _Traits>  __istream_type;
+      typedef typename __istream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __is.flags();
+      __is.flags(__ios_base::dec | __ios_base::skipws);
+
+      size_t __n;
+      __is >> __n;
+
+      std::vector<_RealType> __int_vec;
+      for (size_t __i = 0; __i <= __n; ++__i)
+       {
+         _RealType __int;
+         __is >> __int;
+         __int_vec.push_back(__int);
+       }
+
+      std::vector<double> __den_vec;
+      for (size_t __i = 0; __i < __n; ++__i)
+       {
+         double __den;
+         __is >> __den;
+         __den_vec.push_back(__den);
+       }
+
+      __x.param(typename piecewise_constant_distribution<_RealType>::
+         param_type(__int_vec.begin(), __int_vec.end(), __den_vec.begin()));
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _RealType>
+    void
+    piecewise_linear_distribution<_RealType>::param_type::
+    _M_initialize()
+    {
+      if (_M_int.size() < 2)
+       {
+         _M_int.clear();
+         _M_int.push_back(_RealType(0));
+         _M_int.push_back(_RealType(1));
+
+         _M_den.clear();
+         _M_den.push_back(1.0);
+         _M_den.push_back(1.0);
+
+         return;
+       }
+
+      double __sum = 0.0;
+      for (size_t __i = 0; __i < _M_int.size() - 1; ++__i)
+       {
+         const _RealType __delta = _M_int[__i + 1] - _M_int[__i];
+         __sum += 0.5 * (_M_den[__i + 1] + _M_den[__i]) * __delta;
+         _M_cp.push_back(__sum);
+         _M_m.push_back((_M_den[__i + 1] - _M_den[__i]) / __delta);
+       }
+
+      //  Now normalize the densities...
+      std::transform(_M_den.begin(), _M_den.end(), _M_den.begin(),
+                    std::bind2nd(std::divides<double>(),__sum));
+      //  ... and partial sums... 
+      std::transform(_M_cp.begin(), _M_cp.end(), _M_cp.begin(),
+                    std::bind2nd(std::divides<double>(), __sum));
+      //  ... and slopes.
+      std::transform(_M_m.begin(), _M_m.end(), _M_m.begin(),
+                    std::bind2nd(std::divides<double>(), __sum));
+      //  Make sure the last cumulative probablility is one.
+      _M_cp[_M_cp.size() - 1] = 1.0;
+    }
+
+  template<typename _RealType>
+    piecewise_linear_distribution<_RealType>::param_type::
+    param_type()
+    : _M_int(), _M_den(), _M_cp(), _M_m()
+    {
+      _M_initialize();
+    }
+
+  template<typename _RealType>
+    template<typename _InputIteratorB, typename _InputIteratorW>
+      piecewise_linear_distribution<_RealType>::param_type::
+      param_type(_InputIteratorB __bbegin,
+                _InputIteratorB __bend,
+                _InputIteratorW __wbegin)
+      : _M_int(), _M_den(), _M_cp(), _M_m()
+      {
+       for (; __bbegin != __bend; ++__bbegin, ++__wbegin)
+         {
+           _M_int.push_back(*__bbegin);
+           _M_den.push_back(*__wbegin);
+         }
+
+       _M_initialize();
+      }
+
+  template<typename _RealType>
+    template<typename _Func>
+      piecewise_linear_distribution<_RealType>::param_type::
+      param_type(initializer_list<_RealType> __bil, _Func __fw)
+      : _M_int(), _M_den(), _M_cp(), _M_m()
+      {
+       for (auto __biter = __bil.begin(); __biter != __bil.end(); ++__biter)
+         {
+           _M_int.push_back(*__biter);
+           _M_den.push_back(__fw(*__biter));
+         }
+
+       _M_initialize();
+      }
+
+  template<typename _RealType>
+    template<typename _Func>
+      piecewise_linear_distribution<_RealType>::param_type::
+      param_type(size_t __nw, _RealType __xmin, _RealType __xmax,
+                _Func __fw)
+      : _M_int(), _M_den(), _M_cp(), _M_m()
+      {
+       for (size_t __i = 0; __i <= __nw; ++__i)
+         {
+           const _RealType __x = ((__nw - __i) * __xmin
+                                         + __i * __xmax) / __nw;
+           _M_int.push_back(__x);
+           _M_den.push_back(__fw(__x));
+         }
+
+       _M_initialize();
+      }
+
+  template<typename _RealType>
+    template<typename _UniformRandomNumberGenerator>
+      typename piecewise_linear_distribution<_RealType>::result_type
+      piecewise_linear_distribution<_RealType>::
+      operator()(_UniformRandomNumberGenerator& __urng,
+                const param_type& __param)
+      {
+       result_type __x;
+       __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
+         __aurng(__urng);
+
+       const double __p = __aurng();
+       auto __pos = std::lower_bound(__param._M_cp.begin(),
+                                     __param._M_cp.end(), __p);
+       const size_t __i = __pos - __param._M_cp.begin();
+       const double __a = 0.5 * __param._M_m[__i];
+       const double __b = __param._M_den[__i];
+       const double __c = __param._M_cp[__i];
+       const double __q = -0.5 * (__b
+#if _GLIBCXX_USE_C99_MATH_TR1
+                        + std::copysign(std::sqrt(__b * __b
+                                                - 4.0 * __a * __c), __b));
+#else
+                        + (__b < 0.0 ? -1.0 : 1.0)
+                        * std::sqrt(__b * __b - 4.0 * __a * __c)));
+#endif
+       const double __x0 = __param._M_int[__i];
+       const double __x1 = __q / __a;
+       const double __x2 = __c / __q;
+       __x = std::max(__x0 + __x1, __x0 + __x2);
+
+       return __x;
+      }
+
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+              const piecewise_linear_distribution<_RealType>& __x)
+    {
+      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;
+      typedef typename __ostream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __os.flags();
+      const _CharT __fill = __os.fill();
+      const std::streamsize __precision = __os.precision();
+      const _CharT __space = __os.widen(' ');
+      __os.flags(__ios_base::scientific | __ios_base::left);
+      __os.fill(__space);
+      __os.precision(std::numeric_limits<_RealType>::digits10 + 1);
+
+      std::vector<_RealType> __int = __x.intervals();
+      __os << __int.size() - 1;
+
+      for (auto __xit = __int.begin(); __xit != __int.end(); ++__xit)
+       __os << __space << *__xit;
+
+      std::vector<double> __den = __x.densities();
+      for (auto __dit = __den.begin(); __dit != __den.end(); ++__dit)
+       __os << __space << *__dit;
+
+      __os.flags(__flags);
+      __os.fill(__fill);
+      __os.precision(__precision);
+      return __os;
+    }
+
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+              piecewise_linear_distribution<_RealType>& __x)
+    {
+      typedef std::basic_istream<_CharT, _Traits>  __istream_type;
+      typedef typename __istream_type::ios_base    __ios_base;
+
+      const typename __ios_base::fmtflags __flags = __is.flags();
+      __is.flags(__ios_base::dec | __ios_base::skipws);
+
+      size_t __n;
+      __is >> __n;
+
+      std::vector<_RealType> __int_vec;
+      for (size_t __i = 0; __i <= __n; ++__i)
+       {
+         _RealType __int;
+         __is >> __int;
+         __int_vec.push_back(__int);
+       }
+
+      std::vector<double> __den_vec;
+      for (size_t __i = 0; __i <= __n; ++__i)
+       {
+         double __den;
+         __is >> __den;
+         __den_vec.push_back(__den);
+       }
+
+      __x.param(typename piecewise_linear_distribution<_RealType>::
+         param_type(__int_vec.begin(), __int_vec.end(), __den_vec.begin()));
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _IntType>
+    seed_seq::seed_seq(std::initializer_list<_IntType> __il)
+    {
+      for (auto __iter = __il.begin(); __iter != __il.end(); ++__iter)
+       _M_v.push_back(__detail::__mod<result_type, 1, 0,
+                      __detail::_Shift<result_type, 32>::__value>(*__iter));
+    }
+
+  template<typename _InputIterator>
+    seed_seq::seed_seq(_InputIterator __begin, _InputIterator __end)
+    {
+      for (_InputIterator __iter = __begin; __iter != __end; ++__iter)
+       _M_v.push_back(__detail::__mod<result_type, 1, 0,
+                      __detail::_Shift<result_type, 32>::__value>(*__iter));
+    }
+
+  template<typename _RandomAccessIterator>
+    void
+    seed_seq::generate(_RandomAccessIterator __begin,
+                      _RandomAccessIterator __end)
+    {
+      typedef typename iterator_traits<_RandomAccessIterator>::value_type
+        __Type;
+
+      if (__begin == __end)
+       return;
+
+      std::fill(__begin, __end, __Type(0x8b8b8b8bU));
+
+      const size_t __n = __end - __begin;
+      const size_t __s = _M_v.size();
+      const size_t __t = (__n >= 623) ? 11
+                      : (__n >=  68) ? 7
+                      : (__n >=  39) ? 5
+                      : (__n >=   7) ? 3
+                      : (__n - 1) / 2;
+      const size_t __p = (__n - __t) / 2;
+      const size_t __q = __p + __t;
+      const size_t __m = std::max(__s + 1, __n);
+
+      for (size_t __k = 0; __k < __m; ++__k)
+       {
+         __Type __arg = __begin[__k % __n]
+                      ^ __begin[(__k + __p) % __n]
+                      ^ __begin[(__k - 1) % __n];
+         __Type __r1 = __arg ^ (__arg << 27);
+         __r1 = __detail::__mod<__Type, 1664525U, 0U,
+                  __detail::_Shift<__Type, 32>::__value>(__r1);
+         __Type __r2 = __r1;
+         if (__k == 0)
+           __r2 += __s;
+         else if (__k <= __s)
+           __r2 += __k % __n + _M_v[__k - 1];
+         else
+           __r2 += __k % __n;
+         __r2 = __detail::__mod<__Type, 1U, 0U,
+                  __detail::_Shift<__Type, 32>::__value>(__r2);
+         __begin[(__k + __p) % __n] += __r1;
+         __begin[(__k + __q) % __n] += __r2;
+         __begin[__k % __n] = __r2;
+       }
+
+      for (size_t __k = __m; __k < __m + __n; ++__k)
+       {
+         __Type __arg = __begin[__k % __n]
+                      + __begin[(__k + __p) % __n]
+                      + __begin[(__k - 1) % __n];
+         __Type __r3 = __arg ^ (__arg << 27);
+         __r3 = __detail::__mod<__Type, 1566083941U, 0U,
+                  __detail::_Shift<__Type, 32>::__value>(__r3);
+         __Type __r4 = __r3 - __k % __n;
+         __r4 = __detail::__mod<__Type, 1U, 0U,
+                  __detail::_Shift<__Type, 32>::__value>(__r4);
+         __begin[(__k + __p) % __n] ^= __r4;
+         __begin[(__k + __q) % __n] ^= __r3;
+         __begin[__k % __n] = __r4;
+       }
+    }
+
+  template<typename _RealType, size_t __bits,
+          typename _UniformRandomNumberGenerator>
+    _RealType
+    generate_canonical(_UniformRandomNumberGenerator& __urng)
+    {
+      const size_t __b
+       = std::min(static_cast<size_t>(std::numeric_limits<_RealType>::digits),
+                   __bits);
+      const long double __r = static_cast<long double>(__urng.max())
+                           - static_cast<long double>(__urng.min()) + 1.0L;
+      const size_t __log2r = std::log2l(__r);
+      size_t __k = std::max<size_t>(1UL, (__b + __log2r - 1UL) / __log2r);
+      _RealType __sum = _RealType(0);
+      _RealType __tmp = _RealType(1);
+      for (; __k != 0; --__k)
+       {
+         __sum += _RealType(__urng() - __urng.min()) * __tmp;
+         __tmp *= __r;
+       }
+      return __sum / __tmp;
+    }
+
+}
index 395604b..52a0b73 100644 (file)
 #include <debug/debug.h>
 #include <type_traits>
 
-#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
-#  include <tr1_impl/random>
-#else
-#  define _GLIBCXX_INCLUDE_AS_CXX0X
-#  define _GLIBCXX_BEGIN_NAMESPACE_TR1
-#  define _GLIBCXX_END_NAMESPACE_TR1
-#  define _GLIBCXX_TR1
-#  include <tr1_impl/random>
-#  undef _GLIBCXX_TR1
-#  undef _GLIBCXX_END_NAMESPACE_TR1
-#  undef _GLIBCXX_BEGIN_NAMESPACE_TR1
-#  undef _GLIBCXX_INCLUDE_AS_CXX0X
+#include <bits/random.h>
+
+#ifndef _GLIBCXX_EXPORT_TEMPLATE
+# include <bits/random.tcc>
 #endif
 
 #endif // __GXX_EXPERIMENTAL_CXX0X__
index 49a3b21..6f6e323 100644 (file)
 #include <tr1/cmath>
 
 #if defined(_GLIBCXX_INCLUDE_AS_TR1)
-#  include <tr1_impl/random>
+#  include <tr1/random.h>
 #else
 #  define _GLIBCXX_INCLUDE_AS_TR1
-#  define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
-#  define _GLIBCXX_END_NAMESPACE_TR1 }
 #  define _GLIBCXX_TR1 tr1::
-#  include <tr1_impl/random>
+#  include <tr1/random.h>
 #  undef _GLIBCXX_TR1
-#  undef _GLIBCXX_END_NAMESPACE_TR1
-#  undef _GLIBCXX_BEGIN_NAMESPACE_TR1
 #  undef _GLIBCXX_INCLUDE_AS_TR1
 #endif
 
diff --git a/libstdc++-v3/include/tr1/random.h b/libstdc++-v3/include/tr1/random.h
new file mode 100644 (file)
index 0000000..5a0f6b7
--- /dev/null
@@ -0,0 +1,2436 @@
+// random number generation -*- C++ -*-
+
+// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/**
+ * @file tr1/random.h
+ *  This is an internal header file, included by other library headers.
+ *  You should not attempt to use it directly.
+ */
+
+#ifndef _GLIBCXX_TR1_RANDOM_H
+#define _GLIBCXX_TR1_RANDOM_H 1
+
+#pragma GCC system_header
+
+#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+#  error TR1 header cannot be included from C++0x header
+#endif
+
+#include <cmath>
+#include <cstdio>
+#include <cstdlib>
+#include <string>
+#include <iosfwd>
+#include <limits>
+#include <ext/type_traits.h>
+#include <ext/numeric_traits.h>
+#include <bits/concept_check.h>
+#include <debug/debug.h>
+#include <tr1/type_traits>
+#include <tr1/cmath>
+
+namespace std
+{
+namespace tr1
+{
+
+  // [5.1] Random number generation
+
+  /**
+   * @addtogroup tr1_random Random Number Generation
+   * A facility for generating random numbers on selected distributions.
+   * @{
+   */
+
+  /*
+   * Implementation-space details.
+   */
+  namespace __detail
+  {
+    template<typename _UIntType, int __w, 
+            bool = __w < std::numeric_limits<_UIntType>::digits>
+      struct _Shift
+      { static const _UIntType __value = 0; };
+
+    template<typename _UIntType, int __w>
+      struct _Shift<_UIntType, __w, true>
+      { static const _UIntType __value = _UIntType(1) << __w; };
+
+    template<typename _Tp, _Tp __a, _Tp __c, _Tp __m, bool>
+      struct _Mod;
+
+    // Dispatch based on modulus value to prevent divide-by-zero compile-time
+    // errors when m == 0.
+    template<typename _Tp, _Tp __a, _Tp __c, _Tp __m>
+      inline _Tp
+      __mod(_Tp __x)
+      { return _Mod<_Tp, __a, __c, __m, __m == 0>::__calc(__x); }
+
+    typedef __gnu_cxx::__conditional_type<(sizeof(unsigned) == 4),
+                   unsigned, unsigned long>::__type _UInt32Type;
+
+    /*
+     * An adaptor class for converting the output of any Generator into
+     * the input for a specific Distribution.
+     */
+    template<typename _Engine, typename _Distribution>
+      struct _Adaptor
+      { 
+       typedef typename remove_reference<_Engine>::type _BEngine;
+       typedef typename _BEngine::result_type           _Engine_result_type;
+       typedef typename _Distribution::input_type       result_type;
+
+      public:
+       _Adaptor(const _Engine& __g)
+       : _M_g(__g) { }
+
+       result_type
+       min() const
+       {
+         result_type __return_value;
+         if (is_integral<_Engine_result_type>::value
+             && is_integral<result_type>::value)
+           __return_value = _M_g.min();
+         else
+           __return_value = result_type(0);
+         return __return_value;
+       }
+
+       result_type
+       max() const
+       {
+         result_type __return_value;
+         if (is_integral<_Engine_result_type>::value
+             && is_integral<result_type>::value)
+           __return_value = _M_g.max();
+         else if (!is_integral<result_type>::value)
+           __return_value = result_type(1);
+         else
+           __return_value = std::numeric_limits<result_type>::max() - 1;
+         return __return_value;
+       }
+
+       /*
+        * Converts a value generated by the adapted random number generator
+        * into a value in the input domain for the dependent random number
+        * distribution.
+        *
+        * Because the type traits are compile time constants only the
+        * appropriate clause of the if statements will actually be emitted
+        * by the compiler.
+        */
+       result_type
+       operator()()
+       {
+         result_type __return_value;
+         if (is_integral<_Engine_result_type>::value
+             && is_integral<result_type>::value)
+           __return_value = _M_g();
+         else if (!is_integral<_Engine_result_type>::value
+                  && !is_integral<result_type>::value)
+           __return_value = result_type(_M_g() - _M_g.min())
+             / result_type(_M_g.max() - _M_g.min());
+         else if (is_integral<_Engine_result_type>::value
+                  && !is_integral<result_type>::value)
+           __return_value = result_type(_M_g() - _M_g.min())
+             / result_type(_M_g.max() - _M_g.min() + result_type(1));
+         else
+           __return_value = (((_M_g() - _M_g.min()) 
+                              / (_M_g.max() - _M_g.min()))
+                             * std::numeric_limits<result_type>::max());
+         return __return_value;
+       }
+
+      private:
+       _Engine _M_g;
+      };
+
+    // Specialization for _Engine*.
+    template<typename _Engine, typename _Distribution>
+      struct _Adaptor<_Engine*, _Distribution>
+      {
+       typedef typename _Engine::result_type      _Engine_result_type;
+       typedef typename _Distribution::input_type result_type;
+
+      public:
+       _Adaptor(_Engine* __g)
+       : _M_g(__g) { }
+
+       result_type
+       min() const
+       {
+         result_type __return_value;
+         if (is_integral<_Engine_result_type>::value
+             && is_integral<result_type>::value)
+           __return_value = _M_g->min();
+         else
+           __return_value = result_type(0);
+         return __return_value;
+       }
+
+       result_type
+       max() const
+       {
+         result_type __return_value;
+         if (is_integral<_Engine_result_type>::value
+             && is_integral<result_type>::value)
+           __return_value = _M_g->max();
+         else if (!is_integral<result_type>::value)
+           __return_value = result_type(1);
+         else
+           __return_value = std::numeric_limits<result_type>::max() - 1;
+         return __return_value;
+       }
+
+       result_type
+       operator()()
+       {
+         result_type __return_value;
+         if (is_integral<_Engine_result_type>::value
+             && is_integral<result_type>::value)
+           __return_value = (*_M_g)();
+         else if (!is_integral<_Engine_result_type>::value
+                  && !is_integral<result_type>::value)
+           __return_value = result_type((*_M_g)() - _M_g->min())
+             / result_type(_M_g->max() - _M_g->min());
+         else if (is_integral<_Engine_result_type>::value
+                  && !is_integral<result_type>::value)
+           __return_value = result_type((*_M_g)() - _M_g->min())
+             / result_type(_M_g->max() - _M_g->min() + result_type(1));
+         else
+           __return_value = ((((*_M_g)() - _M_g->min()) 
+                              / (_M_g->max() - _M_g->min()))
+                             * std::numeric_limits<result_type>::max());
+         return __return_value;
+       }
+
+      private:
+       _Engine* _M_g;
+      };
+  } // namespace __detail
+
+  /**
+   * Produces random numbers on a given distribution function using a
+   * non-uniform random number generation engine.
+   *
+   * @todo the engine_value_type needs to be studied more carefully.
+   */
+  template<typename _Engine, typename _Dist>
+    class variate_generator
+    {
+      // Concept requirements.
+      __glibcxx_class_requires(_Engine, _CopyConstructibleConcept)
+      //  __glibcxx_class_requires(_Engine, _EngineConcept)
+      //  __glibcxx_class_requires(_Dist, _EngineConcept)
+
+    public:
+      typedef _Engine                                engine_type;
+      typedef __detail::_Adaptor<_Engine, _Dist>     engine_value_type;
+      typedef _Dist                                  distribution_type;
+      typedef typename _Dist::result_type            result_type;
+
+      // tr1:5.1.1 table 5.1 requirement
+      typedef typename __gnu_cxx::__enable_if<
+       is_arithmetic<result_type>::value, result_type>::__type _IsValidType;
+
+      /**
+       * Constructs a variate generator with the uniform random number
+       * generator @p __eng for the random distribution @p __dist.
+       *
+       * @throws Any exceptions which may thrown by the copy constructors of
+       * the @p _Engine or @p _Dist objects.
+       */
+      variate_generator(engine_type __eng, distribution_type __dist)
+      : _M_engine(__eng), _M_dist(__dist) { }
+
+      /**
+       * Gets the next generated value on the distribution.
+       */
+      result_type
+      operator()()
+      { return _M_dist(_M_engine); }
+
+      /**
+       * WTF?
+       */
+      template<typename _Tp>
+        result_type
+        operator()(_Tp __value)
+        { return _M_dist(_M_engine, __value); }
+
+      /**
+       * Gets a reference to the underlying uniform random number generator
+       * object.
+       */
+      engine_value_type&
+      engine()
+      { return _M_engine; }
+
+      /**
+       * Gets a const reference to the underlying uniform random number
+       * generator object.
+       */
+      const engine_value_type&
+      engine() const
+      { return _M_engine; }
+
+      /**
+       * Gets a reference to the underlying random distribution.
+       */
+      distribution_type&
+      distribution()
+      { return _M_dist; }
+
+      /**
+       * Gets a const reference to the underlying random distribution.
+       */
+      const distribution_type&
+      distribution() const
+      { return _M_dist; }
+
+      /**
+       * Gets the closed lower bound of the distribution interval.
+       */
+      result_type
+      min() const
+      { return this->di