aboutsummaryrefslogtreecommitdiff
path: root/test/std/numerics/rand
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/numerics/rand')
-rw-r--r--test/std/numerics/rand/nothing_to_do.pass.cpp12
-rw-r--r--test/std/numerics/rand/rand.adapt/nothing_to_do.pass.cpp12
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.disc/assign.pass.cpp56
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.disc/copy.pass.cpp54
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.disc/ctor_engine_copy.pass.cpp29
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.disc/ctor_engine_move.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.disc/ctor_result_type.pass.cpp51
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.disc/ctor_sseq.pass.cpp55
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.disc/default.pass.cpp42
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.disc/discard.pass.cpp52
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.disc/eval.pass.cpp42
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.disc/io.pass.cpp63
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.disc/result_type.pass.cpp42
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.disc/seed_result_type.pass.cpp50
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.disc/seed_sseq.pass.cpp48
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.disc/values.pass.cpp60
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.ibits/assign.pass.cpp56
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.ibits/copy.pass.cpp54
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.ibits/ctor_engine_copy.pass.cpp29
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.ibits/ctor_engine_move.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.ibits/ctor_result_type.pass.cpp51
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.ibits/ctor_sseq.pass.cpp55
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.ibits/default.pass.cpp42
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.ibits/discard.pass.cpp52
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.ibits/eval.pass.cpp141
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.ibits/io.pass.cpp63
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.ibits/result_type.pass.cpp83
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.ibits/seed_result_type.pass.cpp50
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.ibits/seed_sseq.pass.cpp48
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.ibits/values.pass.cpp47
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.shuf/assign.pass.cpp39
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.shuf/copy.pass.cpp38
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.shuf/ctor_engine_copy.pass.cpp31
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.shuf/ctor_engine_move.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.shuf/ctor_result_type.pass.cpp76
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.shuf/ctor_sseq.pass.cpp79
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.shuf/default.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.shuf/discard.pass.cpp37
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.shuf/eval.pass.cpp93
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.shuf/io.pass.cpp48
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.shuf/result_type.pass.cpp83
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.shuf/seed_result_type.pass.cpp36
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.shuf/seed_sseq.pass.cpp35
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.shuf/values.pass.cpp44
-rw-r--r--test/std/numerics/rand/rand.device/ctor.pass.cpp83
-rw-r--r--test/std/numerics/rand/rand.device/entropy.pass.cpp23
-rw-r--r--test/std/numerics/rand/rand.device/eval.pass.cpp35
-rw-r--r--test/std/numerics/rand/rand.dis/nothing_to_do.pass.cpp12
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/nothing_to_do.pass.cpp12
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/assign.pass.cpp33
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/copy.pass.cpp31
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/ctor_double.pass.cpp36
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/ctor_param.pass.cpp28
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eq.pass.cpp36
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval.pass.cpp103
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval_param.pass.cpp107
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/get_param.pass.cpp28
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/io.pass.cpp40
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/max.pass.cpp26
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/min.pass.cpp26
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_assign.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_copy.pass.cpp29
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_ctor.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_eq.pass.cpp36
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_types.pass.cpp27
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/set_param.pass.cpp29
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/types.pass.cpp26
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/assign.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/copy.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/ctor_int_double.pass.cpp40
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/ctor_param.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eq.pass.cpp43
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp475
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval_param.pass.cpp160
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/get_param.pass.cpp29
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/io.pass.cpp41
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/max.pass.cpp27
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/min.pass.cpp27
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/param_assign.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/param_copy.pass.cpp31
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/param_ctor.pass.cpp44
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/param_eq.pass.cpp37
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/param_types.pass.cpp28
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/set_param.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/types.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/assign.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/copy.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/ctor_double.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/ctor_param.pass.cpp29
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eq.pass.cpp37
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval.pass.cpp274
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval_param.pass.cpp160
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/get_param.pass.cpp29
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/io.pass.cpp41
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/max.pass.cpp27
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/min.pass.cpp27
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/param_assign.pass.cpp31
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/param_copy.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/param_ctor.pass.cpp35
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/param_eq.pass.cpp37
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/param_types.pass.cpp28
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/set_param.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/types.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/assign.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/copy.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/ctor_int_double.pass.cpp40
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/ctor_param.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eq.pass.cpp43
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval.pass.cpp272
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval_param.pass.cpp160
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/get_param.pass.cpp29
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/io.pass.cpp41
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/max.pass.cpp27
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/min.pass.cpp27
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/param_assign.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/param_copy.pass.cpp31
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/param_ctor.pass.cpp44
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/param_eq.pass.cpp37
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/param_types.pass.cpp28
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/set_param.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/types.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/nothing_to_do.pass.cpp12
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/assign.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/copy.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/ctor_double_double.pass.cpp40
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/ctor_param.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/eq.pass.cpp37
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/eval.pass.cpp80
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/eval_param.pass.cpp83
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/get_param.pass.cpp29
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/io.pass.cpp41
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/max.pass.cpp28
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/min.pass.cpp27
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/param_assign.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/param_copy.pass.cpp31
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/param_ctor.pass.cpp44
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/param_eq.pass.cpp37
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/param_types.pass.cpp28
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/set_param.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/types.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/assign.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/copy.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/ctor_double.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/ctor_param.pass.cpp29
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eq.pass.cpp37
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval.pass.cpp154
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval_param.pass.cpp157
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/get_param.pass.cpp29
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/io.pass.cpp41
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/max.pass.cpp28
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/min.pass.cpp27
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/param_assign.pass.cpp31
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/param_copy.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/param_ctor.pass.cpp35
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/param_eq.pass.cpp37
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/param_types.pass.cpp28
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/set_param.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/types.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/assign.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/copy.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/ctor_double_double.pass.cpp40
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/ctor_param.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eq.pass.cpp37
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp106
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval_param.pass.cpp109
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/get_param.pass.cpp29
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/io.pass.cpp41
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/max.pass.cpp28
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/min.pass.cpp27
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_assign.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_copy.pass.cpp31
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_ctor.pass.cpp44
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_eq.pass.cpp37
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_types.pass.cpp28
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/set_param.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/types.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/assign.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/copy.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/ctor_double_double.pass.cpp40
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/ctor_param.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eq.pass.cpp37
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval.pass.cpp244
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval_param.pass.cpp250
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/get_param.pass.cpp29
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/io.pass.cpp41
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/max.pass.cpp28
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/min.pass.cpp27
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/param_assign.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/param_copy.pass.cpp31
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/param_ctor.pass.cpp44
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/param_eq.pass.cpp37
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/param_types.pass.cpp28
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/set_param.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/types.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/assign.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/copy.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/ctor_double_double.pass.cpp40
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/ctor_param.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eq.pass.cpp37
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval.pass.cpp70
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval_param.pass.cpp71
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/get_param.pass.cpp29
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/io.pass.cpp41
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/max.pass.cpp28
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/min.pass.cpp27
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/param_assign.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/param_copy.pass.cpp31
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/param_ctor.pass.cpp44
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/param_eq.pass.cpp37
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/param_types.pass.cpp28
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/set_param.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/types.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/assign.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/copy.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/ctor_double.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/ctor_param.pass.cpp29
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eq.pass.cpp37
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval.pass.cpp142
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval_param.pass.cpp145
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/get_param.pass.cpp29
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/io.pass.cpp41
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/max.pass.cpp28
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/min.pass.cpp27
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/param_assign.pass.cpp31
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/param_copy.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/param_ctor.pass.cpp35
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/param_eq.pass.cpp37
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/param_types.pass.cpp28
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/set_param.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/types.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/nothing_to_do.pass.cpp12
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/assign.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/copy.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/ctor_double.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/ctor_param.pass.cpp29
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eq.pass.cpp37
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eval.pass.cpp154
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eval_param.pass.cpp75
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/get_param.pass.cpp29
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/io.pass.cpp41
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/max.pass.cpp28
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/min.pass.cpp27
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/param_assign.pass.cpp31
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/param_copy.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/param_ctor.pass.cpp35
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/param_eq.pass.cpp37
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/param_types.pass.cpp28
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/set_param.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/types.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/assign.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/copy.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/ctor_double_double.pass.cpp40
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/ctor_param.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eq.pass.cpp37
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval.pass.cpp190
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval_param.pass.cpp194
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/get_param.pass.cpp29
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/io.pass.cpp41
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/max.pass.cpp28
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/min.pass.cpp27
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/param_assign.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/param_copy.pass.cpp31
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/param_ctor.pass.cpp44
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/param_eq.pass.cpp37
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/param_types.pass.cpp28
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/set_param.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/types.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/assign.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/copy.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/ctor_double_double.pass.cpp40
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/ctor_param.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eq.pass.cpp37
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval.pass.cpp154
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval_param.pass.cpp157
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/get_param.pass.cpp29
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/io.pass.cpp41
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/max.pass.cpp28
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/min.pass.cpp27
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/param_assign.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/param_copy.pass.cpp31
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/param_ctor.pass.cpp44
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/param_eq.pass.cpp37
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/param_types.pass.cpp28
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/set_param.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/types.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/assign.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/copy.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/ctor_double.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/ctor_param.pass.cpp29
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eq.pass.cpp37
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval.pass.cpp151
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval_param.pass.cpp157
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/get_param.pass.cpp29
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/io.pass.cpp41
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/max.pass.cpp28
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/min.pass.cpp27
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/param_assign.pass.cpp31
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/param_copy.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/param_ctor.pass.cpp35
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/param_eq.pass.cpp37
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/param_types.pass.cpp28
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/set_param.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/types.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/assign.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/copy.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/ctor_double_double.pass.cpp40
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/ctor_param.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eq.pass.cpp37
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eval.pass.cpp166
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eval_param.pass.cpp169
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/get_param.pass.cpp29
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/io.pass.cpp41
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/max.pass.cpp28
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/min.pass.cpp27
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/param_assign.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/param_copy.pass.cpp31
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/param_ctor.pass.cpp44
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/param_eq.pass.cpp37
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/param_types.pass.cpp28
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/set_param.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/types.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/nothing_to_do.pass.cpp12
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/assign.pass.cpp35
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/copy.pass.cpp33
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/ctor_default.pass.cpp29
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/ctor_func.pass.cpp60
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/ctor_init.pass.cpp81
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/ctor_iterator.pass.cpp87
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/ctor_param.pass.cpp33
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/eq.pass.cpp45
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/eval.pass.cpp279
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/eval_param.pass.cpp45
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/get_param.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/io.pass.cpp42
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/max.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/min.pass.cpp28
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_assign.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_copy.pass.cpp31
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_default.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_func.pass.cpp64
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_init.pass.cpp88
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_iterator.pass.cpp94
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_eq.pass.cpp39
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_types.pass.cpp28
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/set_param.pass.cpp31
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/types.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/assign.pass.cpp36
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/copy.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_default.pass.cpp35
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_func.pass.cpp64
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_init_func.pass.cpp78
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_iterator.pass.cpp96
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_param.pass.cpp41
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eq.pass.cpp47
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval.pass.cpp695
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval_param.pass.cpp97
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/get_param.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/io.pass.cpp44
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/max.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/min.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_assign.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_copy.pass.cpp33
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_ctor_default.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_ctor_func.pass.cpp67
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_ctor_init_func.pass.cpp79
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_ctor_iterator.pass.cpp100
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_eq.pass.cpp41
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_types.pass.cpp28
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/set_param.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/types.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/assign.pass.cpp36
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/copy.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_default.pass.cpp36
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_func.pass.cpp69
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_init_func.pass.cpp82
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_iterator.pass.cpp101
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_param.pass.cpp42
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eq.pass.cpp47
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp343
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp92
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/get_param.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/io.pass.cpp44
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/max.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/min.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_assign.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_copy.pass.cpp33
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_ctor_default.pass.cpp35
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_ctor_func.pass.cpp70
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_ctor_init_func.pass.cpp83
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_ctor_iterator.pass.cpp105
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_eq.pass.cpp41
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_types.pass.cpp28
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/set_param.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/types.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/nothing_to_do.pass.cpp12
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/assign.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/copy.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/ctor_int_int.pass.cpp41
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/ctor_param.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eq.pass.cpp37
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eval.pass.cpp455
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eval_param.pass.cpp75
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/get_param.pass.cpp29
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/io.pass.cpp41
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/max.pass.cpp27
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/min.pass.cpp27
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/param_assign.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/param_copy.pass.cpp31
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/param_ctor.pass.cpp44
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/param_eq.pass.cpp37
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/param_types.pass.cpp28
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/set_param.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/types.pass.cpp27
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/assign.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/copy.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/ctor_int_int.pass.cpp41
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/ctor_param.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eq.pass.cpp37
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval.pass.cpp474
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval_param.pass.cpp74
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/get_param.pass.cpp29
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/io.pass.cpp41
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/max.pass.cpp27
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/min.pass.cpp27
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/param_assign.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/param_copy.pass.cpp31
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/param_ctor.pass.cpp44
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/param_eq.pass.cpp37
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/param_types.pass.cpp28
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/set_param.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/types.pass.cpp27
-rw-r--r--test/std/numerics/rand/rand.eng/nothing_to_do.pass.cpp12
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.lcong/assign.pass.cpp58
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.lcong/copy.pass.cpp58
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.lcong/ctor_result_type.pass.cpp154
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.lcong/ctor_sseq.pass.cpp29
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.lcong/default.pass.cpp57
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.lcong/discard.pass.cpp73
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.lcong/eval.pass.cpp87
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.lcong/io.pass.cpp44
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.lcong/result_type.pass.cpp37
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.lcong/seed_result_type.pass.cpp40
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.lcong/seed_sseq.pass.cpp39
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp74
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.mers/assign.pass.cpp58
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.mers/copy.pass.cpp56
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.mers/ctor_result_type.pass.cpp245
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.mers/ctor_sseq.pass.cpp309
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.mers/default.pass.cpp45
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.mers/discard.pass.cpp55
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.mers/eval.pass.cpp45
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.mers/io.pass.cpp69
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.mers/result_type.pass.cpp44
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.mers/seed_result_type.pass.cpp52
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.mers/seed_sseq.pass.cpp50
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.mers/values.pass.cpp122
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.sub/assign.pass.cpp56
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.sub/copy.pass.cpp54
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.sub/ctor_result_type.pass.cpp51
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.sub/ctor_sseq.pass.cpp55
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.sub/default.pass.cpp42
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.sub/discard.pass.cpp52
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.sub/eval.pass.cpp42
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.sub/io.pass.cpp63
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.sub/result_type.pass.cpp42
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.sub/seed_result_type.pass.cpp50
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.sub/seed_sseq.pass.cpp48
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.sub/values.pass.cpp70
-rw-r--r--test/std/numerics/rand/rand.predef/default_random_engine.pass.cpp22
-rw-r--r--test/std/numerics/rand/rand.predef/knuth_b.pass.cpp22
-rw-r--r--test/std/numerics/rand/rand.predef/minstd_rand.pass.cpp23
-rw-r--r--test/std/numerics/rand/rand.predef/minstd_rand0.pass.cpp23
-rw-r--r--test/std/numerics/rand/rand.predef/mt19937.pass.cpp27
-rw-r--r--test/std/numerics/rand/rand.predef/mt19937_64.pass.cpp27
-rw-r--r--test/std/numerics/rand/rand.predef/ranlux24.pass.cpp22
-rw-r--r--test/std/numerics/rand/rand.predef/ranlux24_base.pass.cpp22
-rw-r--r--test/std/numerics/rand/rand.predef/ranlux48.pass.cpp22
-rw-r--r--test/std/numerics/rand/rand.predef/ranlux48_base.pass.cpp22
-rw-r--r--test/std/numerics/rand/rand.req/nothing_to_do.pass.cpp12
-rw-r--r--test/std/numerics/rand/rand.req/rand.req.adapt/nothing_to_do.pass.cpp12
-rw-r--r--test/std/numerics/rand/rand.req/rand.req.dst/nothing_to_do.pass.cpp12
-rw-r--r--test/std/numerics/rand/rand.req/rand.req.eng/nothing_to_do.pass.cpp12
-rw-r--r--test/std/numerics/rand/rand.req/rand.req.genl/nothing_to_do.pass.cpp12
-rw-r--r--test/std/numerics/rand/rand.req/rand.req.seedseq/nothing_to_do.pass.cpp12
-rw-r--r--test/std/numerics/rand/rand.req/rand.req.urng/nothing_to_do.pass.cpp12
-rw-r--r--test/std/numerics/rand/rand.synopsis/version.pass.cpp20
-rw-r--r--test/std/numerics/rand/rand.util/nothing_to_do.pass.cpp12
-rw-r--r--test/std/numerics/rand/rand.util/rand.util.canonical/generate_canonical.pass.cpp100
-rw-r--r--test/std/numerics/rand/rand.util/rand.util.seedseq/assign.fail.cpp23
-rw-r--r--test/std/numerics/rand/rand.util/rand.util.seedseq/copy.fail.cpp22
-rw-r--r--test/std/numerics/rand/rand.util/rand.util.seedseq/default.pass.cpp23
-rw-r--r--test/std/numerics/rand/rand.util/rand.util.seedseq/generate.pass.cpp805
-rw-r--r--test/std/numerics/rand/rand.util/rand.util.seedseq/initializer_list.pass.cpp33
-rw-r--r--test/std/numerics/rand/rand.util/rand.util.seedseq/iterator.pass.cpp32
-rw-r--r--test/std/numerics/rand/rand.util/rand.util.seedseq/types.pass.cpp24
495 files changed, 25939 insertions, 0 deletions
diff --git a/test/std/numerics/rand/nothing_to_do.pass.cpp b/test/std/numerics/rand/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..b58f5c55b643
--- /dev/null
+++ b/test/std/numerics/rand/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/numerics/rand/rand.adapt/nothing_to_do.pass.cpp b/test/std/numerics/rand/rand.adapt/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..b58f5c55b643
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.disc/assign.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/assign.pass.cpp
new file mode 100644
index 000000000000..18c8947af6ee
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/assign.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t p, size_t r>
+// class discard_block_engine
+
+// discard_block_engine& operator=(const discard_block_engine&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::ranlux24 E;
+ E e1(2);
+ e1();
+ E e2(5);
+ e2 = e1;
+ assert(e1 == e2);
+ assert(e1() == e2());
+ E::result_type k = e1();
+ assert(e1 != e2);
+ assert(e2() == k);
+ assert(e1 == e2);
+}
+
+void
+test2()
+{
+ typedef std::ranlux48 E;
+ E e1(3);
+ e1();
+ E e2(5);
+ e2 = e1;
+ assert(e1 == e2);
+ assert(e1() == e2());
+ E::result_type k = e1();
+ assert(e1 != e2);
+ assert(e2() == k);
+ assert(e1 == e2);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.disc/copy.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/copy.pass.cpp
new file mode 100644
index 000000000000..d6c64fa37dcc
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/copy.pass.cpp
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t p, size_t r>
+// class discard_block_engine
+
+// discard_block_engine(const discard_block_engine&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::ranlux24 E;
+ E e1;
+ e1();
+ E e2 = e1;
+ assert(e1 == e2);
+ assert(e1() == e2());
+ E::result_type k = e1();
+ assert(e1 != e2);
+ assert(e2() == k);
+ assert(e1 == e2);
+}
+
+void
+test2()
+{
+ typedef std::ranlux48 E;
+ E e1;
+ e1();
+ E e2 = e1;
+ assert(e1 == e2);
+ assert(e1() == e2());
+ E::result_type k = e1();
+ assert(e1 != e2);
+ assert(e2() == k);
+ assert(e1 == e2);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.disc/ctor_engine_copy.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/ctor_engine_copy.pass.cpp
new file mode 100644
index 000000000000..d6b8b33ad01b
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/ctor_engine_copy.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t p, size_t r>
+// class discard_block_engine
+
+// explicit discard_block_engine(const Engine& e);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::ranlux24_base Engine;
+ typedef std::ranlux24 Adaptor;
+ Engine e;
+ Adaptor a(e);
+ assert(a.base() == e);
+ }
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.disc/ctor_engine_move.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/ctor_engine_move.pass.cpp
new file mode 100644
index 000000000000..1e8e2fe6fbbe
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/ctor_engine_move.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t p, size_t r>
+// class discard_block_engine
+
+// explicit discard_block_engine(const Engine& e);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::ranlux24_base Engine;
+ typedef std::ranlux24 Adaptor;
+ Engine e;
+ Engine e0 = e;
+ Adaptor a(std::move(e0));
+ assert(a.base() == e);
+ }
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.disc/ctor_result_type.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/ctor_result_type.pass.cpp
new file mode 100644
index 000000000000..dba254f1a73e
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/ctor_result_type.pass.cpp
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t p, size_t r>
+// class discard_block_engine
+
+// explicit discard_block_engine(result_type s = default_seed);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+void
+test1()
+{
+ const char* a = "15136306 8587749 2346244 16479026 15515802 9510553 "
+ "16090340 14501685 13839944 10789678 11581259 9590790 5840316 5953700 "
+ "13398366 8134459 16629731 6851902 15583892 1317475 4231148 9092691 "
+ "5707268 2355175 0 0";
+ std::ranlux24 e1(0);
+ std::ostringstream os;
+ os << e1;
+ assert(os.str() == a);
+}
+
+void
+test2()
+{
+ const char* a = "10880375256626 126660097854724 33643165434010 "
+ "78293780235492 179418984296008 96783156950859 238199764491708 "
+ "34339434557790 155299155394531 29014415493780 209265474179052 "
+ "263777435457028 0 0";
+ std::ranlux48 e1(0);
+ std::ostringstream os;
+ os << e1;
+ assert(os.str() == a);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.disc/ctor_sseq.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/ctor_sseq.pass.cpp
new file mode 100644
index 000000000000..b64d4b31682b
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/ctor_sseq.pass.cpp
@@ -0,0 +1,55 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t p, size_t r>
+// class discard_block_engine
+
+// template<class Sseq> explicit discard_block_engine(Sseq& q);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+void
+test1()
+{
+ const char* a = "13604817 711567 9760686 13278398 3323440 175548 5553651 "
+ "3028863 10748297 2216688 275779 14778841 14438394 9483441 4229545 "
+ "14657301 12636508 15978210 1653340 1718567 9272421 14302862 7940348 "
+ "889045 0 0";
+ unsigned as[] = {3, 5, 7};
+ std::seed_seq sseq(as, as+3);
+ std::ranlux24 e1(sseq);
+ std::ostringstream os;
+ os << e1;
+ assert(os.str() == a);
+}
+
+void
+test2()
+{
+ const char* a = "241408498702289 172342669275054 191026374555184 "
+ "61020585639411 231929771458953 142769679250755 198672786411514 "
+ "183712717244841 227473912549724 62843577252444 68782400568421 "
+ "159248704678140 0 0";
+ unsigned as[] = {3, 5, 7};
+ std::seed_seq sseq(as, as+3);
+ std::ranlux48 e1(sseq);
+ std::ostringstream os;
+ os << e1;
+ assert(os.str() == a);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.disc/default.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/default.pass.cpp
new file mode 100644
index 000000000000..ffdaebc17142
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/default.pass.cpp
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t p, size_t r>
+// class discard_block_engine
+
+// explicit discard_block_engine();
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ std::ranlux24 e1;
+ std::ranlux24 e2(std::ranlux24_base::default_seed);
+ assert(e1 == e2);
+ assert(e1() == 15039276);
+}
+
+void
+test2()
+{
+ std::ranlux48 e1;
+ std::ranlux48 e2(std::ranlux48_base::default_seed);
+ assert(e1 == e2);
+ assert(e1() == 23459059301164ull);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.disc/discard.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/discard.pass.cpp
new file mode 100644
index 000000000000..2dada0d6345f
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/discard.pass.cpp
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t p, size_t r>
+// class discard_block_engine
+
+// void discard(unsigned long long z);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ std::ranlux24 e1;
+ std::ranlux24 e2 = e1;
+ assert(e1 == e2);
+ e1.discard(3);
+ assert(e1 != e2);
+ e2();
+ e2();
+ e2();
+ assert(e1 == e2);
+}
+
+void
+test2()
+{
+ std::ranlux48 e1;
+ std::ranlux48 e2 = e1;
+ assert(e1 == e2);
+ e1.discard(3);
+ assert(e1 != e2);
+ e2();
+ e2();
+ e2();
+ assert(e1 == e2);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.disc/eval.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/eval.pass.cpp
new file mode 100644
index 000000000000..f819d6a97699
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/eval.pass.cpp
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t p, size_t r>
+// class discard_block_engine
+
+// result_type operator()();
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ std::ranlux24 e;
+ assert(e() == 15039276u);
+ assert(e() == 16323925u);
+ assert(e() == 14283486u);
+}
+
+void
+test2()
+{
+ std::ranlux48 e;
+ assert(e() == 23459059301164ull);
+ assert(e() == 28639057539807ull);
+ assert(e() == 276846226770426ull);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.disc/io.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/io.pass.cpp
new file mode 100644
index 000000000000..4b742f06a5eb
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/io.pass.cpp
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t p, size_t r>
+// class discard_block_engine
+
+// template <class charT, class traits,
+// class Engine, size_t p, size_t r>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& os,
+// const discard_block_engine<Engine, p, r>& x);
+//
+// template <class charT, class traits,
+// class Engine, size_t p, size_t r>
+// basic_istream<charT, traits>&
+// operator>>(basic_istream<charT, traits>& is,
+// discard_block_engine<Engine, p, r>& x);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::ranlux24 E;
+ E e1;
+ e1.discard(100);
+ std::ostringstream os;
+ os << e1;
+ std::istringstream is(os.str());
+ E e2;
+ is >> e2;
+ assert(e1 == e2);
+}
+
+void
+test2()
+{
+ typedef std::ranlux48 E;
+ E e1;
+ e1.discard(100);
+ std::ostringstream os;
+ os << e1;
+ std::istringstream is(os.str());
+ E e2;
+ is >> e2;
+ assert(e1 == e2);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.disc/result_type.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/result_type.pass.cpp
new file mode 100644
index 000000000000..2634aba3823b
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/result_type.pass.cpp
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t p, size_t r>
+// class discard_block_engine
+// {
+// public:
+// // types
+// typedef typename Engine::result_type result_type;
+
+#include <random>
+#include <type_traits>
+
+void
+test1()
+{
+ static_assert((std::is_same<
+ std::ranlux24::result_type,
+ std::uint_fast32_t>::value), "");
+}
+
+void
+test2()
+{
+ static_assert((std::is_same<
+ std::ranlux48::result_type,
+ std::uint_fast64_t>::value), "");
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.disc/seed_result_type.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/seed_result_type.pass.cpp
new file mode 100644
index 000000000000..6a5ff14f77ab
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/seed_result_type.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t p, size_t r>
+// class discard_block_engine
+
+// void seed(result_type s = default_seed);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ for (int s = 0; s < 20; ++s)
+ {
+ typedef std::ranlux24 E;
+ E e1(s);
+ E e2;
+ e2.seed(s);
+ assert(e1 == e2);
+ }
+}
+
+void
+test2()
+{
+ for (int s = 0; s < 20; ++s)
+ {
+ typedef std::ranlux48 E;
+ E e1(s);
+ E e2;
+ e2.seed(s);
+ assert(e1 == e2);
+ }
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.disc/seed_sseq.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/seed_sseq.pass.cpp
new file mode 100644
index 000000000000..0da09a379e6f
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/seed_sseq.pass.cpp
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t p, size_t r>
+// class discard_block_engine
+
+// template<class Sseq> void seed(Sseq& q);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ unsigned a[] = {3, 5, 7};
+ std::seed_seq sseq(a, a+3);
+ std::ranlux24 e1;
+ std::ranlux24 e2(sseq);
+ assert(e1 != e2);
+ e1.seed(sseq);
+ assert(e1 == e2);
+}
+
+void
+test2()
+{
+ unsigned a[] = {3, 5, 7};
+ std::seed_seq sseq(a, a+3);
+ std::ranlux48 e1;
+ std::ranlux48 e2(sseq);
+ assert(e1 != e2);
+ e1.seed(sseq);
+ assert(e1 == e2);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.disc/values.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/values.pass.cpp
new file mode 100644
index 000000000000..53e4c29affc4
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/values.pass.cpp
@@ -0,0 +1,60 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t p, size_t r>
+// class discard_block_engine
+// {
+// public:
+// // types
+// typedef typename Engine::result_type result_type;
+//
+// // engine characteristics
+// static constexpr size_t block_size = p;
+// static constexpr size_t used_block = r;
+// static constexpr result_type min() { return Engine::min(); }
+// static constexpr result_type max() { return Engine::max(); }
+
+#include <random>
+#include <type_traits>
+#include <cassert>
+
+template <class _Tp>
+void where(const _Tp &) {}
+
+void
+test1()
+{
+ typedef std::ranlux24 E;
+ static_assert((E::block_size == 223), "");
+ static_assert((E::used_block == 23), "");
+ /*static_*/assert((E::min() == 0)/*, ""*/);
+ /*static_*/assert((E::max() == 0xFFFFFF)/*, ""*/);
+ where(E::block_size);
+ where(E::used_block);
+}
+
+void
+test2()
+{
+ typedef std::ranlux48 E;
+ static_assert((E::block_size == 389), "");
+ static_assert((E::used_block == 11), "");
+ /*static_*/assert((E::min() == 0)/*, ""*/);
+ /*static_*/assert((E::max() == 0xFFFFFFFFFFFFull)/*, ""*/);
+ where(E::block_size);
+ where(E::used_block);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/assign.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/assign.pass.cpp
new file mode 100644
index 000000000000..e4cd4f7396be
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/assign.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t w, class UIntType>
+// class independent_bits_engine
+
+// independent_bits_engine& operator=(const independent_bits_engine&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::independent_bits_engine<std::ranlux24, 32, unsigned> E;
+ E e1(2);
+ e1();
+ E e2(5);
+ e2 = e1;
+ assert(e1 == e2);
+ assert(e1() == e2());
+ E::result_type k = e1();
+ assert(e1 != e2);
+ assert(e2() == k);
+ assert(e1 == e2);
+}
+
+void
+test2()
+{
+ typedef std::independent_bits_engine<std::ranlux48, 64, unsigned long long> E;
+ E e1(3);
+ e1();
+ E e2(5);
+ e2 = e1;
+ assert(e1 == e2);
+ assert(e1() == e2());
+ E::result_type k = e1();
+ assert(e1 != e2);
+ assert(e2() == k);
+ assert(e1 == e2);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/copy.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/copy.pass.cpp
new file mode 100644
index 000000000000..e3e497ec8c6e
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/copy.pass.cpp
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t w, class UIntType>
+// class independent_bits_engine
+
+// independent_bits_engine(const independent_bits_engine&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::independent_bits_engine<std::ranlux24, 32, unsigned> E;
+ E e1;
+ e1();
+ E e2 = e1;
+ assert(e1 == e2);
+ assert(e1() == e2());
+ E::result_type k = e1();
+ assert(e1 != e2);
+ assert(e2() == k);
+ assert(e1 == e2);
+}
+
+void
+test2()
+{
+ typedef std::independent_bits_engine<std::ranlux48, 64, unsigned long long> E;
+ E e1;
+ e1();
+ E e2 = e1;
+ assert(e1 == e2);
+ assert(e1() == e2());
+ E::result_type k = e1();
+ assert(e1 != e2);
+ assert(e2() == k);
+ assert(e1 == e2);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/ctor_engine_copy.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/ctor_engine_copy.pass.cpp
new file mode 100644
index 000000000000..193f5c33ec11
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/ctor_engine_copy.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t w, class UIntType>
+// class independent_bits_engine
+
+// explicit independent_bits_engine(const Engine& e);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::mt19937 Engine;
+ typedef std::independent_bits_engine<Engine, 24, unsigned> Adaptor;
+ Engine e;
+ Adaptor a(e);
+ assert(a.base() == e);
+ }
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/ctor_engine_move.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/ctor_engine_move.pass.cpp
new file mode 100644
index 000000000000..60a661d398f6
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/ctor_engine_move.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t w, class UIntType>
+// class independent_bits_engine
+
+// explicit independent_bits_engine(const Engine& e);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::mt19937 Engine;
+ typedef std::independent_bits_engine<Engine, 24, unsigned> Adaptor;
+ Engine e;
+ Engine e0 = e;
+ Adaptor a(std::move(e0));
+ assert(a.base() == e);
+ }
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/ctor_result_type.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/ctor_result_type.pass.cpp
new file mode 100644
index 000000000000..8e8d3091a4e3
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/ctor_result_type.pass.cpp
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t w, class UIntType>
+// class independent_bits_engine
+
+// explicit independent_bits_engine(result_type s = default_seed);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+void
+test1()
+{
+ const char* a = "15136306 8587749 2346244 16479026 15515802 9510553 "
+ "16090340 14501685 13839944 10789678 11581259 9590790 5840316 5953700 "
+ "13398366 8134459 16629731 6851902 15583892 1317475 4231148 9092691 "
+ "5707268 2355175 0 0";
+ std::independent_bits_engine<std::ranlux24, 32, unsigned> e1(0);
+ std::ostringstream os;
+ os << e1;
+ assert(os.str() == a);
+}
+
+void
+test2()
+{
+ const char* a = "10880375256626 126660097854724 33643165434010 "
+ "78293780235492 179418984296008 96783156950859 238199764491708 "
+ "34339434557790 155299155394531 29014415493780 209265474179052 "
+ "263777435457028 0 0";
+ std::independent_bits_engine<std::ranlux48, 64, unsigned long long> e1(0);
+ std::ostringstream os;
+ os << e1;
+ assert(os.str() == a);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/ctor_sseq.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/ctor_sseq.pass.cpp
new file mode 100644
index 000000000000..7965f4397f5a
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/ctor_sseq.pass.cpp
@@ -0,0 +1,55 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t w, class UIntType>
+// class independent_bits_engine
+
+// template<class Sseq> explicit independent_bits_engine(Sseq& q);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+void
+test1()
+{
+ const char* a = "13604817 711567 9760686 13278398 3323440 175548 5553651 "
+ "3028863 10748297 2216688 275779 14778841 14438394 9483441 4229545 "
+ "14657301 12636508 15978210 1653340 1718567 9272421 14302862 7940348 "
+ "889045 0 0";
+ unsigned as[] = {3, 5, 7};
+ std::seed_seq sseq(as, as+3);
+ std::independent_bits_engine<std::ranlux24, 32, unsigned> e1(sseq);
+ std::ostringstream os;
+ os << e1;
+ assert(os.str() == a);
+}
+
+void
+test2()
+{
+ const char* a = "241408498702289 172342669275054 191026374555184 "
+ "61020585639411 231929771458953 142769679250755 198672786411514 "
+ "183712717244841 227473912549724 62843577252444 68782400568421 "
+ "159248704678140 0 0";
+ unsigned as[] = {3, 5, 7};
+ std::seed_seq sseq(as, as+3);
+ std::independent_bits_engine<std::ranlux48, 64, unsigned long long> e1(sseq);
+ std::ostringstream os;
+ os << e1;
+ assert(os.str() == a);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/default.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/default.pass.cpp
new file mode 100644
index 000000000000..ccb6f379d50c
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/default.pass.cpp
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t w, class UIntType>
+// class independent_bits_engine
+
+// explicit independent_bits_engine();
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ std::independent_bits_engine<std::ranlux24, 32, unsigned> e1;
+ std::independent_bits_engine<std::ranlux24, 32, unsigned> e2(std::ranlux24_base::default_seed);
+ assert(e1 == e2);
+ assert(e1() == 2066486613);
+}
+
+void
+test2()
+{
+ std::independent_bits_engine<std::ranlux48, 64, unsigned long long> e1;
+ std::independent_bits_engine<std::ranlux48, 64, unsigned long long> e2(std::ranlux48_base::default_seed);
+ assert(e1 == e2);
+ assert(e1() == 18223106896348967647ull);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/discard.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/discard.pass.cpp
new file mode 100644
index 000000000000..2a356a1c80db
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/discard.pass.cpp
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t w, class UIntType>
+// class independent_bits_engine
+
+// void discard(unsigned long long z);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ std::independent_bits_engine<std::ranlux24, 32, unsigned> e1;
+ std::independent_bits_engine<std::ranlux24, 32, unsigned> e2 = e1;
+ assert(e1 == e2);
+ e1.discard(3);
+ assert(e1 != e2);
+ e2();
+ e2();
+ e2();
+ assert(e1 == e2);
+}
+
+void
+test2()
+{
+ std::independent_bits_engine<std::ranlux48, 64, unsigned long long> e1;
+ std::independent_bits_engine<std::ranlux48, 64, unsigned long long> e2 = e1;
+ assert(e1 == e2);
+ e1.discard(3);
+ assert(e1 != e2);
+ e2();
+ e2();
+ e2();
+ assert(e1 == e2);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/eval.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/eval.pass.cpp
new file mode 100644
index 000000000000..1c2b2a80c59b
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/eval.pass.cpp
@@ -0,0 +1,141 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t w, class UIntType>
+// class independent_bits_engine
+
+// result_type operator()();
+
+#include <random>
+#include <cassert>
+
+template <class UIntType, UIntType Min, UIntType Max>
+class rand1
+{
+public:
+ // types
+ typedef UIntType result_type;
+
+private:
+ result_type x_;
+
+ static_assert(Min < Max, "rand1 invalid parameters");
+public:
+
+#ifdef _LIBCPP_HAS_NO_CONSTEXPR
+ // Workaround for lack of constexpr in C++03
+ static const result_type _Min = Min;
+ static const result_type _Max = Max;
+#endif
+
+ static _LIBCPP_CONSTEXPR result_type min() {return Min;}
+ static _LIBCPP_CONSTEXPR result_type max() {return Max;}
+
+ explicit rand1(result_type sd = Min) : x_(sd)
+ {
+ if (x_ > Max)
+ x_ = Max;
+ }
+
+ result_type operator()()
+ {
+ result_type r = x_;
+ if (x_ < Max)
+ ++x_;
+ else
+ x_ = Min;
+ return r;
+ }
+};
+
+void
+test1()
+{
+ typedef std::independent_bits_engine<rand1<unsigned, 0, 10>, 16, unsigned> E;
+
+ E e;
+ assert(e() == 6958);
+}
+
+void
+test2()
+{
+ typedef std::independent_bits_engine<rand1<unsigned, 0, 100>, 16, unsigned> E;
+
+ E e;
+ assert(e() == 66);
+}
+
+void
+test3()
+{
+ typedef std::independent_bits_engine<rand1<unsigned, 0, 0xFFFFFFFF>, 32, unsigned> E;
+
+ E e(5);
+ assert(e() == 5);
+}
+
+void
+test4()
+{
+ typedef std::independent_bits_engine<rand1<unsigned, 0, 0xFFFFFFFF>, 7, unsigned> E;
+
+ E e(129);
+ assert(e() == 1);
+}
+
+void
+test5()
+{
+ typedef std::independent_bits_engine<rand1<unsigned, 2, 3>, 1, unsigned> E;
+
+ E e(6);
+ assert(e() == 1);
+}
+
+void
+test6()
+{
+ typedef std::independent_bits_engine<rand1<unsigned, 2, 3>, 11, unsigned> E;
+
+ E e(6);
+ assert(e() == 1365);
+}
+
+void
+test7()
+{
+ typedef std::independent_bits_engine<rand1<unsigned, 2, 3>, 32, unsigned> E;
+
+ E e(6);
+ assert(e() == 2863311530u);
+}
+
+void
+test8()
+{
+ typedef std::independent_bits_engine<std::mt19937, 64, unsigned long long> E;
+
+ E e(6);
+ assert(e() == 16470362623952407241ull);
+}
+
+int main()
+{
+ test1();
+ test2();
+ test3();
+ test4();
+ test5();
+ test6();
+ test7();
+ test8();
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/io.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/io.pass.cpp
new file mode 100644
index 000000000000..9bcf06488247
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/io.pass.cpp
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t w, class UIntType>
+// class independent_bits_engine
+
+// template <class charT, class traits,
+// class Engine, size_t w, class UIntType>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& os,
+// const independent_bits_engine<Engine, w, UIntType>& x);
+//
+// template <class charT, class traits,
+// class Engine, size_t w, class UIntType>
+// basic_istream<charT, traits>&
+// operator>>(basic_istream<charT, traits>& is,
+// independent_bits_engine<Engine, w, UIntType>& x);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::independent_bits_engine<std::ranlux24, 32, unsigned> E;
+ E e1;
+ e1.discard(100);
+ std::ostringstream os;
+ os << e1;
+ std::istringstream is(os.str());
+ E e2;
+ is >> e2;
+ assert(e1 == e2);
+}
+
+void
+test2()
+{
+ typedef std::independent_bits_engine<std::ranlux48, 64, unsigned long long> E;
+ E e1;
+ e1.discard(100);
+ std::ostringstream os;
+ os << e1;
+ std::istringstream is(os.str());
+ E e2;
+ is >> e2;
+ assert(e1 == e2);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/result_type.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/result_type.pass.cpp
new file mode 100644
index 000000000000..78040ad987d1
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/result_type.pass.cpp
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t w, class UIntType>
+// class independent_bits_engine
+// {
+// public:
+// // types
+// typedef UIntType result_type;
+
+#include <random>
+#include <type_traits>
+
+template <class UIntType, UIntType Min, UIntType Max>
+class rand1
+{
+public:
+ // types
+ typedef UIntType result_type;
+
+private:
+ result_type x_;
+
+ static_assert(Min < Max, "rand1 invalid parameters");
+public:
+
+#ifdef _LIBCPP_HAS_NO_CONSTEXPR
+ // Workaround for lack of constexpr in C++03
+ static const result_type _Min = Min;
+ static const result_type _Max = Max;
+#endif
+
+ static _LIBCPP_CONSTEXPR result_type min() {return Min;}
+ static _LIBCPP_CONSTEXPR result_type max() {return Max;}
+
+ explicit rand1(result_type sd = Min) : x_(sd)
+ {
+ if (x_ < Min)
+ x_ = Min;
+ if (x_ > Max)
+ x_ = Max;
+ }
+
+ result_type operator()()
+ {
+ result_type r = x_;
+ if (x_ < Max)
+ ++x_;
+ else
+ x_ = Min;
+ return r;
+ }
+};
+
+void
+test1()
+{
+ static_assert((std::is_same<
+ std::independent_bits_engine<rand1<unsigned long, 0, 10>, 16, unsigned>::result_type,
+ unsigned>::value), "");
+}
+
+void
+test2()
+{
+ static_assert((std::is_same<
+ std::independent_bits_engine<rand1<unsigned long, 0, 10>, 16, unsigned long long>::result_type,
+ unsigned long long>::value), "");
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/seed_result_type.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/seed_result_type.pass.cpp
new file mode 100644
index 000000000000..e8c24ca5fee9
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/seed_result_type.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t w, class UIntType>
+// class independent_bits_engine
+
+// void seed(result_type s = default_seed);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ for (int s = 0; s < 20; ++s)
+ {
+ typedef std::independent_bits_engine<std::ranlux24, 32, unsigned> E;
+ E e1(s);
+ E e2;
+ e2.seed(s);
+ assert(e1 == e2);
+ }
+}
+
+void
+test2()
+{
+ for (int s = 0; s < 20; ++s)
+ {
+ typedef std::independent_bits_engine<std::ranlux48, 64, unsigned long long> E;
+ E e1(s);
+ E e2;
+ e2.seed(s);
+ assert(e1 == e2);
+ }
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/seed_sseq.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/seed_sseq.pass.cpp
new file mode 100644
index 000000000000..ec83fff7f83b
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/seed_sseq.pass.cpp
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t w, class UIntType>
+// class independent_bits_engine
+
+// template<class Sseq> void seed(Sseq& q);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ unsigned a[] = {3, 5, 7};
+ std::seed_seq sseq(a, a+3);
+ std::independent_bits_engine<std::ranlux24, 32, unsigned> e1;
+ std::independent_bits_engine<std::ranlux24, 32, unsigned> e2(sseq);
+ assert(e1 != e2);
+ e1.seed(sseq);
+ assert(e1 == e2);
+}
+
+void
+test2()
+{
+ unsigned a[] = {3, 5, 7};
+ std::seed_seq sseq(a, a+3);
+ std::independent_bits_engine<std::ranlux48, 64, unsigned long long> e1;
+ std::independent_bits_engine<std::ranlux48, 64, unsigned long long> e2(sseq);
+ assert(e1 != e2);
+ e1.seed(sseq);
+ assert(e1 == e2);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/values.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/values.pass.cpp
new file mode 100644
index 000000000000..20ca7d5510bf
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/values.pass.cpp
@@ -0,0 +1,47 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t w, class UIntType>
+// class independent_bits_engine
+// {
+// public:
+// // types
+// typedef UIntType result_type;
+//
+// // engine characteristics
+// static constexpr result_type min() { return 0; }
+// static constexpr result_type max() { return 2^w - 1; }
+
+#include <random>
+#include <type_traits>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::independent_bits_engine<std::ranlux24, 32, unsigned> E;
+ /*static_*/assert((E::min() == 0)/*, ""*/);
+ /*static_*/assert((E::max() == 0xFFFFFFFF)/*, ""*/);
+}
+
+void
+test2()
+{
+ typedef std::independent_bits_engine<std::ranlux48, 64, unsigned long long> E;
+ /*static_*/assert((E::min() == 0)/*, ""*/);
+ /*static_*/assert((E::max() == 0xFFFFFFFFFFFFFFFFull)/*, ""*/);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/assign.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/assign.pass.cpp
new file mode 100644
index 000000000000..dae8c7c919af
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/assign.pass.cpp
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t k>
+// class shuffle_order_engine
+
+// shuffle_order_engine& operator=(const shuffle_order_engine&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::knuth_b E;
+ E e1(2);
+ e1();
+ E e2(5);
+ e2 = e1;
+ assert(e1 == e2);
+ assert(e1() == e2());
+ E::result_type k = e1();
+ assert(e1 != e2);
+ assert(e2() == k);
+ assert(e1 == e2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/copy.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/copy.pass.cpp
new file mode 100644
index 000000000000..c9e9893dee4b
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/copy.pass.cpp
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t k>
+// class shuffle_order_engine
+
+// shuffle_order_engine(const shuffle_order_engine&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::knuth_b E;
+ E e1;
+ e1();
+ E e2 = e1;
+ assert(e1 == e2);
+ assert(e1() == e2());
+ E::result_type k = e1();
+ assert(e1 != e2);
+ assert(e2() == k);
+ assert(e1 == e2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/ctor_engine_copy.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/ctor_engine_copy.pass.cpp
new file mode 100644
index 000000000000..a20c494f334c
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/ctor_engine_copy.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t k>
+// class shuffle_order_engine
+
+// explicit shuffle_order_engine(const Engine& e);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::minstd_rand0 Engine;
+ typedef std::knuth_b Adaptor;
+ Engine e;
+ Adaptor a(e);
+ for (unsigned k = 0; k <= Adaptor::table_size; ++k)
+ e();
+ assert(a.base() == e);
+ }
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/ctor_engine_move.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/ctor_engine_move.pass.cpp
new file mode 100644
index 000000000000..9811787821d9
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/ctor_engine_move.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t k>
+// class shuffle_order_engine
+
+// explicit shuffle_order_engine(const Engine& e);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::minstd_rand0 Engine;
+ typedef std::knuth_b Adaptor;
+ Engine e;
+ Engine e0 = e;
+ Adaptor a(std::move(e0));
+ for (unsigned k = 0; k <= Adaptor::table_size; ++k)
+ e();
+ assert(a.base() == e);
+ }
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/ctor_result_type.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/ctor_result_type.pass.cpp
new file mode 100644
index 000000000000..320249497289
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/ctor_result_type.pass.cpp
@@ -0,0 +1,76 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t k>
+// class shuffle_order_engine
+
+// explicit shuffle_order_engine(result_type s = default_seed);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+void
+test1()
+{
+ const char* a = "1771550148 168070 677268843 1194115201 1259501992 "
+ "703671065 407145426 1010275440 1693606898 1702877348 745024267 "
+ "1793193459 416963415 664975744 742430420 1148079870 637806795 "
+ "1527921388 165317290 1791337459 1435426120 375508442 1863429808 "
+ "1910758855 653618747 991426424 578291095 1974930990 1157900898 "
+ "343583572 25567821 221638147 1335692731 1341167826 1019292670 "
+ "774852571 606325389 700907908 1211405961 1955012967 1403137269 "
+ "1010152376 1772753897 486628401 1145807831 1106352968 1560917450 "
+ "679350398 1819071734 1561434646 781928982 1427964481 1669276942 "
+ "811199786 1608612146 1272705739 1428231253 1857946652 2097152784 "
+ "197742477 1300609030 99924397 97128425 349867255 408729299 1860625187 "
+ "2018133942 1420442476 1948474080 1025729457 1583749330 15184745 "
+ "1806938869 1655319056 296727307 638820415 1383963552 880037807 "
+ "1075545360 1321008721 1507631161 597371974 544717293 340756290 "
+ "1899563128 1465595994 634440068 777915521 545718511 2135841687 "
+ "1902073804 712854586 135760289 1095544109 285050585 1956649285 "
+ "987446484 259432572 891434194 1488577086 330596852 801096775 "
+ "1458514382 1872871416 1682074633 1153627723 1538775345 51662594 "
+ "709823970 739804705 2114844452 1188863267 1037076781 1172179215 "
+ "1948572574 533634468 902793804 1283497773 273836696 315894151 "
+ "653420473 1954002600 1601768276 64415940 306945492 577163950 "
+ "210874151 813838307 857078006 1737226413 376658679 1868110244 "
+ "1117951768 1080937173 1746896638 1842856729 1883887269 2141922362 "
+ "1020763473 1872318475 978729834 1935067665 1189895487 1205729145 "
+ "1034046923 1788963337 188263312 898072753 1393688555 1119406056 "
+ "1900835472 1375045132 1312008157 559007303 2142269543 413383599 "
+ "628550348 573639243 1100665718 464587168 65992084 1027393936 "
+ "1641360472 1918007189 69800406 609352380 35938117 569027612 902394793 "
+ "1019770837 221470752 669768613 1839284764 1979413630 1335703733 "
+ "1526078440 1403144959 1139398206 753967943 1785700701 1187714882 "
+ "1063522909 1123137582 192083544 680202567 1109090588 327456556 "
+ "1709233078 191596027 1076438936 1306955024 1530346852 127901445 "
+ "8455468 377129974 1199230721 1336700752 1103107597 703058228 "
+ "844612202 530372344 1910850558 47387421 1871435357 1168551137 "
+ "1101007744 1918050856 803711675 309982095 73743043 301259382 "
+ "1647477295 1644236294 859823662 638826571 1487427444 335916581 "
+ "15468904 140348241 895842081 410006250 1847504174 536600445 "
+ "1359845362 1400027760 288242141 1910039802 1453396858 1761991428 "
+ "2137921913 357210187 1414819544 1933136424 943782705 841706193 "
+ "1081202962 1919045067 333546776 988345562 337850989 314809455 "
+ "1750287624 853099962 1450233962 142805884 1399258689 247367726 "
+ "2128513937 1151147433 654730608 351121428 12778440 18876380 "
+ "1575222551 587014441 411835569 380613902 1771550148";
+ std::knuth_b e1(10);
+ std::ostringstream os;
+ os << e1;
+ assert(os.str() == a);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/ctor_sseq.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/ctor_sseq.pass.cpp
new file mode 100644
index 000000000000..a08df07b3a87
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/ctor_sseq.pass.cpp
@@ -0,0 +1,79 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t k>
+// class shuffle_order_engine
+
+// template<class Sseq> explicit shuffle_order_engine(Sseq& q);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+void
+test1()
+{
+ const char* a = "1894661934 884942216 1899568837 1561547157 525417712 "
+ "242729120 1476874187 1208468883 1983666902 1953485886 1507290666 "
+ "1317123450 632390874 696850315 1734917114 218976032 1690682513 "
+ "1944862534 456017951 2072049961 1348874775 1700965693 828093387 "
+ "2071522749 1077957279 1055942061 413360419 238964088 475007126 "
+ "1248050783 1516729632 1044035134 9617501 580065782 1737324341 "
+ "2022534575 219953662 941840747 415472792 1381878747 200458524 "
+ "1852054372 1849850586 1318041283 1026024576 101363422 660501483 "
+ "705453438 298717379 1873705814 673416290 868766340 614560427 "
+ "1668238166 532360730 969915708 1972423626 1966307090 97417947 "
+ "920896215 588041576 495024338 522400288 1068491480 878048146 "
+ "1995051285 17282737 560668414 2143274709 127339385 1299331283 "
+ "99667038 66663006 1566161755 773555006 272986904 1065825536 "
+ "1168683925 1185292013 1144552919 1489883454 811887358 279732868 "
+ "628609193 1562647158 1833265343 1742736292 639398211 357562689 "
+ "896869717 501615326 1775469607 1032409784 43371928 955037563 "
+ "1023543663 1354331571 1071539244 562210166 138213162 1518791327 "
+ "1335204647 1727874626 2114964448 1058152392 1055171537 348065433 "
+ "190278003 399246038 1389247438 1639480282 382424917 2144508195 "
+ "1531185764 1342593547 1359065400 1176108308 1412845568 968776497 "
+ "5573525 1332437854 323541262 329396230 2097079291 1110029273 "
+ "1071549822 739994612 1011644107 1074473050 478563727 894301674 "
+ "290189565 280656618 1121689914 1630931232 579945916 1870220126 "
+ "71516543 1535179528 1893792038 1107650479 1893348357 93154853 "
+ "138035708 683805596 1535656875 1326628479 1469623399 1751042846 "
+ "661214234 1947241260 1780560187 690441964 1403944207 1687457460 "
+ "1428487938 1877084153 1618585041 1383427538 461185097 869443256 "
+ "1254069404 1739961370 1245924391 138197640 1257913073 1915996843 "
+ "641653536 1755587965 1889101622 1732723706 2009073422 1611621773 "
+ "315899200 738279016 94909546 1711873548 1620302377 181922632 "
+ "1704446343 1345319468 2076463060 357902023 157605314 1025175647 "
+ "865799248 138769064 124418006 1591838311 675218651 1096276609 "
+ "1858759850 732186041 769493777 735387805 894450150 638142050 "
+ "720101232 1671055379 636619387 898507955 118193981 63865192 "
+ "1787942091 204050966 2100684950 1580797970 1951284753 1020070334 "
+ "960149537 1041144801 823914651 558983501 1742229329 708805658 "
+ "804904097 1023665826 1260041465 1180659188 590074436 301564006 "
+ "324841922 714752380 1967212989 290476911 815113546 815183409 "
+ "1989370850 1182975807 870784323 171062356 1711897606 2024645183 "
+ "1333203966 314683764 1785282634 603713754 1904315050 1874254109 "
+ "1298675767 1967311508 1946285744 753588304 1847558969 1457540010 "
+ "528986741 97857407 1864449494 1868752281 1171249392 1353422942 "
+ "832597170 457192338 335135800 1925268166 1845956613 296546482 "
+ "1894661934";
+ unsigned as[] = {3, 5, 7};
+ std::seed_seq sseq(as, as+3);
+ std::knuth_b e1(sseq);
+ std::ostringstream os;
+ os << e1;
+ assert(os.str() == a);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/default.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/default.pass.cpp
new file mode 100644
index 000000000000..7b4bc582095f
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/default.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t k>
+// class shuffle_order_engine
+
+// explicit shuffle_order_engine();
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ std::knuth_b e1;
+ std::knuth_b e2(std::minstd_rand0::default_seed);
+ assert(e1 == e2);
+ assert(e1() == 152607844u);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/discard.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/discard.pass.cpp
new file mode 100644
index 000000000000..6e04e26c7e55
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/discard.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t k>
+// class shuffle_order_engine
+
+// void discard(unsigned long long z);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ std::knuth_b e1;
+ std::knuth_b e2 = e1;
+ assert(e1 == e2);
+ e1.discard(3);
+ assert(e1 != e2);
+ e2();
+ e2();
+ e2();
+ assert(e1 == e2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/eval.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/eval.pass.cpp
new file mode 100644
index 000000000000..c218c17dde69
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/eval.pass.cpp
@@ -0,0 +1,93 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t k>
+// class shuffle_order_engine
+
+// result_type operator()();
+
+#include <random>
+#include <cassert>
+
+template <class UIntType, UIntType Min, UIntType Max>
+class rand1
+{
+public:
+ // types
+ typedef UIntType result_type;
+
+private:
+ result_type x_;
+
+ static_assert(Min < Max, "rand1 invalid parameters");
+public:
+
+#ifdef _LIBCPP_HAS_NO_CONSTEXPR
+ // Workaround for lack of constexpr in C++03
+ static const result_type _Min = Min;
+ static const result_type _Max = Max;
+#endif
+
+ static _LIBCPP_CONSTEXPR result_type min() {return Min;}
+ static _LIBCPP_CONSTEXPR result_type max() {return Max;}
+
+ explicit rand1(result_type sd = Min) : x_(sd)
+ {
+ if (x_ > Max)
+ x_ = Max;
+ }
+
+ result_type operator()()
+ {
+ result_type r = x_;
+ if (x_ < Max)
+ ++x_;
+ else
+ x_ = Min;
+ return r;
+ }
+};
+
+void
+test1()
+{
+ typedef std::knuth_b E;
+
+ E e;
+ assert(e() == 152607844u);
+}
+
+void
+test2()
+{
+ typedef rand1<unsigned long long, 0, 0xFFFFFFFFFFFFFFFFull> E0;
+ typedef std::shuffle_order_engine<E0, 101> E;
+ E e;
+ e.discard(400);
+ assert(e() == 501);
+}
+
+void
+test3()
+{
+ typedef rand1<unsigned long long, 0, 0xFFFFFFFFFFFFFFFFull> E0;
+ typedef std::shuffle_order_engine<E0, 100> E;
+ E e;
+ e.discard(400);
+ assert(e() == 500);
+}
+
+int main()
+{
+ test1();
+ test2();
+ test3();
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/io.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/io.pass.cpp
new file mode 100644
index 000000000000..6c8fdb998bfd
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/io.pass.cpp
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t k>
+// class shuffle_order_engine
+
+// template <class charT, class traits,
+// class Engine, size_t k>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& os,
+// const shuffle_order_engine<Engine, k>& x);
+//
+// template <class charT, class traits,
+// class Engine, size_t k>
+// basic_istream<charT, traits>&
+// operator>>(basic_istream<charT, traits>& is,
+// shuffle_order_engine<Engine, k>& x);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::knuth_b E;
+ E e1;
+ e1.discard(100);
+ std::ostringstream os;
+ os << e1;
+ std::istringstream is(os.str());
+ E e2;
+ is >> e2;
+ assert(e1 == e2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/result_type.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/result_type.pass.cpp
new file mode 100644
index 000000000000..3271d933cb27
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/result_type.pass.cpp
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t k>
+// class shuffle_order_engine
+// {
+// public:
+// // types
+// typedef typename Engine::result_type result_type;
+
+#include <random>
+#include <type_traits>
+
+template <class UIntType, UIntType Min, UIntType Max>
+class rand1
+{
+public:
+ // types
+ typedef UIntType result_type;
+
+private:
+ result_type x_;
+
+ static_assert(Min < Max, "rand1 invalid parameters");
+public:
+
+#ifdef _LIBCPP_HAS_NO_CONSTEXPR
+ // Workaround for lack of constexpr in C++03
+ static const result_type _Min = Min;
+ static const result_type _Max = Max;
+#endif
+
+ static _LIBCPP_CONSTEXPR result_type min() {return Min;}
+ static _LIBCPP_CONSTEXPR result_type max() {return Max;}
+
+ explicit rand1(result_type sd = Min) : x_(sd)
+ {
+ if (x_ < Min)
+ x_ = Min;
+ if (x_ > Max)
+ x_ = Max;
+ }
+
+ result_type operator()()
+ {
+ result_type r = x_;
+ if (x_ < Max)
+ ++x_;
+ else
+ x_ = Min;
+ return r;
+ }
+};
+
+void
+test1()
+{
+ static_assert((std::is_same<
+ std::shuffle_order_engine<rand1<unsigned long, 0, 10>, 16>::result_type,
+ unsigned long>::value), "");
+}
+
+void
+test2()
+{
+ static_assert((std::is_same<
+ std::shuffle_order_engine<rand1<unsigned long long, 0, 10>, 16>::result_type,
+ unsigned long long>::value), "");
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/seed_result_type.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/seed_result_type.pass.cpp
new file mode 100644
index 000000000000..57ded845e1ee
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/seed_result_type.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t k>
+// class shuffle_order_engine
+
+// void seed(result_type s = default_seed);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ for (int s = 0; s < 20; ++s)
+ {
+ typedef std::knuth_b E;
+ E e1(s);
+ E e2;
+ e2.seed(s);
+ assert(e1 == e2);
+ }
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/seed_sseq.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/seed_sseq.pass.cpp
new file mode 100644
index 000000000000..4b4b099bce41
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/seed_sseq.pass.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t k>
+// class shuffle_order_engine
+
+// template<class Sseq> void seed(Sseq& q);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ unsigned a[] = {3, 5, 7};
+ std::seed_seq sseq(a, a+3);
+ std::knuth_b e1;
+ std::knuth_b e2(sseq);
+ assert(e1 != e2);
+ e1.seed(sseq);
+ assert(e1 == e2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/values.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/values.pass.cpp
new file mode 100644
index 000000000000..eb42d644d301
--- /dev/null
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/values.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class Engine, size_t k>
+// class shuffle_order_engine
+// {
+// public:
+// // types
+// typedef typename Engine::result_type result_type;
+//
+// // engine characteristics
+// static constexpr size_t table_size = k;
+// static constexpr result_type min() { return Engine::min; }
+// static constexpr result_type max() { return Engine::max; }
+
+#include <random>
+#include <type_traits>
+#include <cassert>
+
+template <class _Tp>
+void where(const _Tp &) {}
+
+void
+test1()
+{
+ typedef std::knuth_b E;
+ static_assert(E::table_size == 256, "");
+ /*static_*/assert((E::min() == 1)/*, ""*/);
+ /*static_*/assert((E::max() == 2147483646)/*, ""*/);
+ where(E::table_size);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.device/ctor.pass.cpp b/test/std/numerics/rand/rand.device/ctor.pass.cpp
new file mode 100644
index 000000000000..97f46b26aa27
--- /dev/null
+++ b/test/std/numerics/rand/rand.device/ctor.pass.cpp
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class random_device;
+
+// explicit random_device(const string& token = implementation-defined);
+
+// For the following ctors, the standard states: "The semantics and default
+// value of the token parameter are implementation-defined". Implementations
+// therefore aren't required to accept any string, but the default shouldn't
+// throw.
+
+#include <random>
+#include <cassert>
+#include <unistd.h>
+
+bool is_valid_random_device(const std::string &token) {
+#if defined(_LIBCPP_USING_DEV_RANDOM)
+ // Not an exhaustive list: they're the only tokens that are tested below.
+ return token == "/dev/urandom" || token == "/dev/random";
+#else
+ return token == "/dev/urandom";
+#endif
+}
+
+void check_random_device_valid(const std::string &token) {
+ std::random_device r(token);
+}
+
+void check_random_device_invalid(const std::string &token) {
+ try {
+ std::random_device r(token);
+ assert(false);
+ } catch (const std::system_error &e) {
+ }
+}
+
+int main() {
+ { std::random_device r; }
+
+ {
+ int ec;
+ ec = close(STDIN_FILENO);
+ assert(!ec);
+ ec = close(STDOUT_FILENO);
+ assert(!ec);
+ ec = close(STDERR_FILENO);
+ assert(!ec);
+ std::random_device r;
+ }
+
+ {
+ std::string token = "wrong file";
+ if (is_valid_random_device(token))
+ check_random_device_valid(token);
+ else
+ check_random_device_invalid(token);
+ }
+
+ {
+ std::string token = "/dev/urandom";
+ if (is_valid_random_device(token))
+ check_random_device_valid(token);
+ else
+ check_random_device_invalid(token);
+ }
+
+ {
+ std::string token = "/dev/random";
+ if (is_valid_random_device(token))
+ check_random_device_valid(token);
+ else
+ check_random_device_invalid(token);
+ }
+}
diff --git a/test/std/numerics/rand/rand.device/entropy.pass.cpp b/test/std/numerics/rand/rand.device/entropy.pass.cpp
new file mode 100644
index 000000000000..f01e5653391f
--- /dev/null
+++ b/test/std/numerics/rand/rand.device/entropy.pass.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class random_device;
+
+// double entropy() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ std::random_device r;
+ double e = r.entropy();
+}
diff --git a/test/std/numerics/rand/rand.device/eval.pass.cpp b/test/std/numerics/rand/rand.device/eval.pass.cpp
new file mode 100644
index 000000000000..72aff076a5df
--- /dev/null
+++ b/test/std/numerics/rand/rand.device/eval.pass.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class random_device;
+
+// result_type operator()();
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ std::random_device r;
+ std::random_device::result_type e = r();
+ }
+
+ try
+ {
+ std::random_device r("/dev/null");
+ r();
+ assert(false);
+ }
+ catch (const std::system_error& e)
+ {
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/nothing_to_do.pass.cpp b/test/std/numerics/rand/rand.dis/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..b58f5c55b643
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/nothing_to_do.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..b58f5c55b643
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/assign.pass.cpp
new file mode 100644
index 000000000000..e55c1579c4cb
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/assign.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+
+// bernoulli_distribution& operator=(const bernoulli_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::bernoulli_distribution D;
+ D d1(0.75);
+ D d2;
+ assert(d1 != d2);
+ d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/copy.pass.cpp
new file mode 100644
index 000000000000..c64f925b4c6b
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/copy.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+
+// bernoulli_distribution(const bernoulli_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::bernoulli_distribution D;
+ D d1(0.75);
+ D d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/ctor_double.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/ctor_double.pass.cpp
new file mode 100644
index 000000000000..5d511fcc6739
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/ctor_double.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+
+// explicit bernoulli_distribution(double p = 0.5);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::bernoulli_distribution D;
+ D d;
+ assert(d.p() == 0.5);
+ }
+ {
+ typedef std::bernoulli_distribution D;
+ D d(0);
+ assert(d.p() == 0);
+ }
+ {
+ typedef std::bernoulli_distribution D;
+ D d(0.75);
+ assert(d.p() == 0.75);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/ctor_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/ctor_param.pass.cpp
new file mode 100644
index 000000000000..a143b5a68f4c
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/ctor_param.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+
+// explicit bernoulli_distribution(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::bernoulli_distribution D;
+ typedef D::param_type P;
+ P p(0.25);
+ D d(p);
+ assert(d.p() == 0.25);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eq.pass.cpp
new file mode 100644
index 000000000000..b77c12eed22e
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eq.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+
+// bool operator=(const bernoulli_distribution& x,
+// const bernoulli_distribution& y);
+// bool operator!(const bernoulli_distribution& x,
+// const bernoulli_distribution& y);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::bernoulli_distribution D;
+ D d1(.25);
+ D d2(.25);
+ assert(d1 == d2);
+ }
+ {
+ typedef std::bernoulli_distribution D;
+ D d1(.28);
+ D d2(.25);
+ assert(d1 != d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval.pass.cpp
new file mode 100644
index 000000000000..f071e8507478
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval.pass.cpp
@@ -0,0 +1,103 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g);
+
+#include <random>
+#include <numeric>
+#include <vector>
+#include <cassert>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x * x;
+}
+
+int main()
+{
+ {
+ typedef std::bernoulli_distribution D;
+ typedef std::minstd_rand G;
+ G g;
+ D d(.75);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ u.push_back(d(g));
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.p();
+ double x_var = d.p()*(1-d.p());
+ double x_skew = (1 - 2 * d.p())/std::sqrt(x_var);
+ double x_kurtosis = (6 * sqr(d.p()) - 6 * d.p() + 1)/x_var;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+ }
+ {
+ typedef std::bernoulli_distribution D;
+ typedef std::minstd_rand G;
+ G g;
+ D d(.25);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ u.push_back(d(g));
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.p();
+ double x_var = d.p()*(1-d.p());
+ double x_skew = (1 - 2 * d.p())/std::sqrt(x_var);
+ double x_kurtosis = (6 * sqr(d.p()) - 6 * d.p() + 1)/x_var;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval_param.pass.cpp
new file mode 100644
index 000000000000..e03fb57f380c
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval_param.pass.cpp
@@ -0,0 +1,107 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
+
+#include <random>
+#include <numeric>
+#include <vector>
+#include <cassert>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x * x;
+}
+
+int main()
+{
+ {
+ typedef std::bernoulli_distribution D;
+ typedef D::param_type P;
+ typedef std::minstd_rand G;
+ G g;
+ D d(.75);
+ P p(.25);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ u.push_back(d(g, p));
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = p.p();
+ double x_var = p.p()*(1-p.p());
+ double x_skew = (1 - 2 * p.p())/std::sqrt(x_var);
+ double x_kurtosis = (6 * sqr(p.p()) - 6 * p.p() + 1)/x_var;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+ }
+ {
+ typedef std::bernoulli_distribution D;
+ typedef D::param_type P;
+ typedef std::minstd_rand G;
+ G g;
+ D d(.25);
+ P p(.75);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ u.push_back(d(g, p));
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = p.p();
+ double x_var = p.p()*(1-p.p());
+ double x_skew = (1 - 2 * p.p())/std::sqrt(x_var);
+ double x_kurtosis = (6 * sqr(p.p()) - 6 * p.p() + 1)/x_var;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/get_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/get_param.pass.cpp
new file mode 100644
index 000000000000..1b4eae90b6a3
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/get_param.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+
+// param_type param() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::bernoulli_distribution D;
+ typedef D::param_type P;
+ P p(.125);
+ D d(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/io.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/io.pass.cpp
new file mode 100644
index 000000000000..5f57145e1311
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/io.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+
+// template <class charT, class traits>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& os,
+// const bernoulli_distribution& x);
+//
+// template <class charT, class traits>
+// basic_istream<charT, traits>&
+// operator>>(basic_istream<charT, traits>& is,
+// bernoulli_distribution& x);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::bernoulli_distribution D;
+ D d1(.25);
+ std::ostringstream os;
+ os << d1;
+ std::istringstream is(os.str());
+ D d2;
+ is >> d2;
+ assert(d1 == d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/max.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/max.pass.cpp
new file mode 100644
index 000000000000..8e669bbda34a
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/max.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+
+// result_type max() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::bernoulli_distribution D;
+ D d(.25);
+ assert(d.max() == true);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/min.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/min.pass.cpp
new file mode 100644
index 000000000000..296ad1474ecf
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/min.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+
+// result_type min() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::bernoulli_distribution D;
+ D d(.5);
+ assert(d.min() == false);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_assign.pass.cpp
new file mode 100644
index 000000000000..a24dd0dfc930
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_assign.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::bernoulli_distribution D;
+ typedef D::param_type param_type;
+ param_type p0(.7);
+ param_type p;
+ p = p0;
+ assert(p.p() == .7);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_copy.pass.cpp
new file mode 100644
index 000000000000..6c4eaeee4da9
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_copy.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::bernoulli_distribution D;
+ typedef D::param_type param_type;
+ param_type p0(.125);
+ param_type p = p0;
+ assert(p.p() == .125);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_ctor.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_ctor.pass.cpp
new file mode 100644
index 000000000000..c43f44721a60
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_ctor.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::bernoulli_distribution D;
+ typedef D::param_type param_type;
+ param_type p;
+ assert(p.p() == 0.5);
+ }
+ {
+ typedef std::bernoulli_distribution D;
+ typedef D::param_type param_type;
+ param_type p(0.25);
+ assert(p.p() == 0.25);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_eq.pass.cpp
new file mode 100644
index 000000000000..ee5dfe867b7e
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_eq.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::bernoulli_distribution D;
+ typedef D::param_type param_type;
+ param_type p1(0.75);
+ param_type p2(0.75);
+ assert(p1 == p2);
+ }
+ {
+ typedef std::bernoulli_distribution D;
+ typedef D::param_type param_type;
+ param_type p1(0.75);
+ param_type p2(0.5);
+ assert(p1 != p2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_types.pass.cpp
new file mode 100644
index 000000000000..5a3b90332120
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_types.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::bernoulli_distribution D;
+ typedef D::param_type param_type;
+ typedef param_type::distribution_type distribution_type;
+ static_assert((std::is_same<D, distribution_type>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/set_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/set_param.pass.cpp
new file mode 100644
index 000000000000..9869ac6fc39c
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/set_param.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+
+// void param(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::bernoulli_distribution D;
+ typedef D::param_type P;
+ P p(0.25);
+ D d(0.75);
+ d.param(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/types.pass.cpp
new file mode 100644
index 000000000000..4b6c4be1a240
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/types.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+// {
+// typedef bool result_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::bernoulli_distribution D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, bool>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/assign.pass.cpp
new file mode 100644
index 000000000000..82473d2883b4
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/assign.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class binomial_distribution
+
+// binomial_distribution& operator=(const binomial_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::binomial_distribution<> D;
+ D d1(2, 0.75);
+ D d2;
+ assert(d1 != d2);
+ d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/copy.pass.cpp
new file mode 100644
index 000000000000..715494886787
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/copy.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class binomial_distribution
+
+// binomial_distribution(const binomial_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::binomial_distribution<> D;
+ D d1(2, 0.75);
+ D d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/ctor_int_double.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/ctor_int_double.pass.cpp
new file mode 100644
index 000000000000..5a3a22eeebdd
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/ctor_int_double.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class binomial_distribution
+
+// explicit binomial_distribution(IntType t = 1, double p = 0.5);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::binomial_distribution<> D;
+ D d;
+ assert(d.t() == 1);
+ assert(d.p() == 0.5);
+ }
+ {
+ typedef std::binomial_distribution<> D;
+ D d(3);
+ assert(d.t() == 3);
+ assert(d.p() == 0.5);
+ }
+ {
+ typedef std::binomial_distribution<> D;
+ D d(3, 0.75);
+ assert(d.t() == 3);
+ assert(d.p() == 0.75);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/ctor_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/ctor_param.pass.cpp
new file mode 100644
index 000000000000..cfb98f2985e1
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/ctor_param.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class binomial_distribution
+
+// explicit binomial_distribution(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::binomial_distribution<> D;
+ typedef D::param_type P;
+ P p(5, 0.25);
+ D d(p);
+ assert(d.t() == 5);
+ assert(d.p() == 0.25);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eq.pass.cpp
new file mode 100644
index 000000000000..738bdc80e934
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eq.pass.cpp
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class binomial_distribution
+
+// bool operator=(const binomial_distribution& x,
+// const binomial_distribution& y);
+// bool operator!(const binomial_distribution& x,
+// const binomial_distribution& y);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::binomial_distribution<> D;
+ D d1(3, .25);
+ D d2(3, .25);
+ assert(d1 == d2);
+ }
+ {
+ typedef std::binomial_distribution<> D;
+ D d1(3, .28);
+ D d2(3, .25);
+ assert(d1 != d2);
+ }
+ {
+ typedef std::binomial_distribution<> D;
+ D d1(3, .25);
+ D d2(4, .25);
+ assert(d1 != d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp
new file mode 100644
index 000000000000..43c6b546bdb2
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp
@@ -0,0 +1,475 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class IntType = int>
+// class binomial_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g);
+
+#include <random>
+#include <numeric>
+#include <vector>
+#include <cassert>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x * x;
+}
+
+int main()
+{
+ {
+ typedef std::binomial_distribution<> D;
+ typedef std::mt19937_64 G;
+ G g;
+ D d(5, .75);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.t() * d.p();
+ double x_var = x_mean*(1-d.p());
+ double x_skew = (1-2*d.p()) / std::sqrt(x_var);
+ double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.04);
+ }
+ {
+ typedef std::binomial_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(30, .03125);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.t() * d.p();
+ double x_var = x_mean*(1-d.p());
+ double x_skew = (1-2*d.p()) / std::sqrt(x_var);
+ double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::binomial_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(40, .25);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.t() * d.p();
+ double x_var = x_mean*(1-d.p());
+ double x_skew = (1-2*d.p()) / std::sqrt(x_var);
+ double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.03);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.3);
+ }
+ {
+ typedef std::binomial_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(40, 0);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ // In this case:
+ // skew computes to 0./0. == nan
+ // kurtosis computes to 0./0. == nan
+ // x_skew == inf
+ // x_kurtosis == inf
+ // These tests are commented out because UBSan warns about division by 0
+// skew /= u.size() * dev * var;
+// kurtosis /= u.size() * var * var;
+// kurtosis -= 3;
+ double x_mean = d.t() * d.p();
+ double x_var = x_mean*(1-d.p());
+// double x_skew = (1-2*d.p()) / std::sqrt(x_var);
+// double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
+ assert(mean == x_mean);
+ assert(var == x_var);
+// assert(skew == x_skew);
+// assert(kurtosis == x_kurtosis);
+ }
+ {
+ typedef std::binomial_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(40, 1);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ // In this case:
+ // skew computes to 0./0. == nan
+ // kurtosis computes to 0./0. == nan
+ // x_skew == -inf
+ // x_kurtosis == inf
+ // These tests are commented out because UBSan warns about division by 0
+// skew /= u.size() * dev * var;
+// kurtosis /= u.size() * var * var;
+// kurtosis -= 3;
+ double x_mean = d.t() * d.p();
+ double x_var = x_mean*(1-d.p());
+// double x_skew = (1-2*d.p()) / std::sqrt(x_var);
+// double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
+ assert(mean == x_mean);
+ assert(var == x_var);
+// assert(skew == x_skew);
+// assert(kurtosis == x_kurtosis);
+ }
+ {
+ typedef std::binomial_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(400, 0.5);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.t() * d.p();
+ double x_var = x_mean*(1-d.p());
+ double x_skew = (1-2*d.p()) / std::sqrt(x_var);
+ double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs(kurtosis - x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::binomial_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(1, 0.5);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.t() * d.p();
+ double x_var = x_mean*(1-d.p());
+ double x_skew = (1-2*d.p()) / std::sqrt(x_var);
+ double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ const int N = 100000;
+ std::mt19937 gen1;
+ std::mt19937 gen2;
+
+ std::binomial_distribution<> dist1(5, 0.1);
+ std::binomial_distribution<unsigned> dist2(5, 0.1);
+
+ for(int i = 0; i < N; ++i)
+ assert(dist1(gen1) == dist2(gen2));
+ }
+ {
+ typedef std::binomial_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(0, 0.005);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ // In this case:
+ // skew computes to 0./0. == nan
+ // kurtosis computes to 0./0. == nan
+ // x_skew == inf
+ // x_kurtosis == inf
+ // These tests are commented out because UBSan warns about division by 0
+// skew /= u.size() * dev * var;
+// kurtosis /= u.size() * var * var;
+// kurtosis -= 3;
+ double x_mean = d.t() * d.p();
+ double x_var = x_mean*(1-d.p());
+// double x_skew = (1-2*d.p()) / std::sqrt(x_var);
+// double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
+ assert(mean == x_mean);
+ assert(var == x_var);
+// assert(skew == x_skew);
+// assert(kurtosis == x_kurtosis);
+ }
+ {
+ typedef std::binomial_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(0, 0);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ // In this case:
+ // skew computes to 0./0. == nan
+ // kurtosis computes to 0./0. == nan
+ // x_skew == inf
+ // x_kurtosis == inf
+ // These tests are commented out because UBSan warns about division by 0
+// skew /= u.size() * dev * var;
+// kurtosis /= u.size() * var * var;
+// kurtosis -= 3;
+ double x_mean = d.t() * d.p();
+ double x_var = x_mean*(1-d.p());
+// double x_skew = (1-2*d.p()) / std::sqrt(x_var);
+// double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
+ assert(mean == x_mean);
+ assert(var == x_var);
+// assert(skew == x_skew);
+// assert(kurtosis == x_kurtosis);
+ }
+ {
+ typedef std::binomial_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(0, 1);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ // In this case:
+ // skew computes to 0./0. == nan
+ // kurtosis computes to 0./0. == nan
+ // x_skew == -inf
+ // x_kurtosis == inf
+ // These tests are commented out because UBSan warns about division by 0
+// skew /= u.size() * dev * var;
+// kurtosis /= u.size() * var * var;
+// kurtosis -= 3;
+ double x_mean = d.t() * d.p();
+ double x_var = x_mean*(1-d.p());
+// double x_skew = (1-2*d.p()) / std::sqrt(x_var);
+// double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
+ assert(mean == x_mean);
+ assert(var == x_var);
+// assert(skew == x_skew);
+// assert(kurtosis == x_kurtosis);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval_param.pass.cpp
new file mode 100644
index 000000000000..1aa66ed57ad1
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval_param.pass.cpp
@@ -0,0 +1,160 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class IntType = int>
+// class binomial_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
+
+#include <random>
+#include <numeric>
+#include <vector>
+#include <cassert>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x * x;
+}
+
+int main()
+{
+ {
+ typedef std::binomial_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937_64 G;
+ G g;
+ D d(16, .75);
+ P p(5, .75);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ assert(0 <= v && v <= p.t());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = p.t() * p.p();
+ double x_var = x_mean*(1-p.p());
+ double x_skew = (1-2*p.p()) / std::sqrt(x_var);
+ double x_kurtosis = (1-6*p.p()*(1-p.p())) / x_var;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.04);
+ }
+ {
+ typedef std::binomial_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(16, .75);
+ P p(30, .03125);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ assert(0 <= v && v <= p.t());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = p.t() * p.p();
+ double x_var = x_mean*(1-p.p());
+ double x_skew = (1-2*p.p()) / std::sqrt(x_var);
+ double x_kurtosis = (1-6*p.p()*(1-p.p())) / x_var;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::binomial_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(16, .75);
+ P p(40, .25);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ assert(0 <= v && v <= p.t());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = p.t() * p.p();
+ double x_var = x_mean*(1-p.p());
+ double x_skew = (1-2*p.p()) / std::sqrt(x_var);
+ double x_kurtosis = (1-6*p.p()*(1-p.p())) / x_var;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.04);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.3);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/get_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/get_param.pass.cpp
new file mode 100644
index 000000000000..88c8424b0934
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/get_param.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class binomial_distribution
+
+// param_type param() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::binomial_distribution<> D;
+ typedef D::param_type P;
+ P p(5, .125);
+ D d(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/io.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/io.pass.cpp
new file mode 100644
index 000000000000..1276454b597b
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/io.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class binomial_distribution
+
+// template <class charT, class traits>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& os,
+// const binomial_distribution& x);
+//
+// template <class charT, class traits>
+// basic_istream<charT, traits>&
+// operator>>(basic_istream<charT, traits>& is,
+// binomial_distribution& x);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::binomial_distribution<> D;
+ D d1(7, .25);
+ std::ostringstream os;
+ os << d1;
+ std::istringstream is(os.str());
+ D d2;
+ is >> d2;
+ assert(d1 == d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/max.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/max.pass.cpp
new file mode 100644
index 000000000000..9c88faabe60b
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/max.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class binomial_distribution
+
+// result_type max() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::binomial_distribution<> D;
+ D d(4, .25);
+ assert(d.max() == 4);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/min.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/min.pass.cpp
new file mode 100644
index 000000000000..678a34b2f54b
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/min.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class binomial_distribution
+
+// result_type min() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::binomial_distribution<> D;
+ D d(4, .5);
+ assert(d.min() == 0);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/param_assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/param_assign.pass.cpp
new file mode 100644
index 000000000000..553f8ad82689
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/param_assign.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class binomial_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::binomial_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p0(6, .7);
+ param_type p;
+ p = p0;
+ assert(p.t() == 6);
+ assert(p.p() == .7);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/param_copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/param_copy.pass.cpp
new file mode 100644
index 000000000000..a9770efa282f
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/param_copy.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class binomial_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::binomial_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p0(10, .125);
+ param_type p = p0;
+ assert(p.t() == 10);
+ assert(p.p() == .125);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/param_ctor.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/param_ctor.pass.cpp
new file mode 100644
index 000000000000..cadf84a89044
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/param_ctor.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class binomial_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::binomial_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p;
+ assert(p.t() == 1);
+ assert(p.p() == 0.5);
+ }
+ {
+ typedef std::binomial_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p(10);
+ assert(p.t() == 10);
+ assert(p.p() == 0.5);
+ }
+ {
+ typedef std::binomial_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p(10, 0.25);
+ assert(p.t() == 10);
+ assert(p.p() == 0.25);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/param_eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/param_eq.pass.cpp
new file mode 100644
index 000000000000..3c2c1faa5c1b
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/param_eq.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class binomial_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::binomial_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p1(3, 0.75);
+ param_type p2(3, 0.75);
+ assert(p1 == p2);
+ }
+ {
+ typedef std::binomial_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p1(3, 0.75);
+ param_type p2(3, 0.5);
+ assert(p1 != p2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/param_types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/param_types.pass.cpp
new file mode 100644
index 000000000000..6c745611cd44
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/param_types.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class binomial_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::binomial_distribution<> D;
+ typedef D::param_type param_type;
+ typedef param_type::distribution_type distribution_type;
+ static_assert((std::is_same<D, distribution_type>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/set_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/set_param.pass.cpp
new file mode 100644
index 000000000000..612f5e2def02
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/set_param.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class binomial_distribution
+
+// void param(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::binomial_distribution<> D;
+ typedef D::param_type P;
+ P p(10, 0.25);
+ D d(8, 0.75);
+ d.param(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/types.pass.cpp
new file mode 100644
index 000000000000..0e71aa019e7e
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/types.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class binomial_distribution
+// {
+// typedef bool result_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::binomial_distribution<> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, int>::value), "");
+ }
+ {
+ typedef std::binomial_distribution<long> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, long>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/assign.pass.cpp
new file mode 100644
index 000000000000..f71b37482ca7
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/assign.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class geometric_distribution
+
+// geometric_distribution& operator=(const geometric_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::geometric_distribution<> D;
+ D d1(0.75);
+ D d2;
+ assert(d1 != d2);
+ d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/copy.pass.cpp
new file mode 100644
index 000000000000..00f3d04aefdb
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/copy.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class geometric_distribution
+
+// geometric_distribution(const geometric_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::geometric_distribution<> D;
+ D d1(0.75);
+ D d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/ctor_double.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/ctor_double.pass.cpp
new file mode 100644
index 000000000000..461542896ecf
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/ctor_double.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class geometric_distribution
+
+// explicit geometric_distribution(double p = 0.5);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::geometric_distribution<> D;
+ D d;
+ assert(d.p() == 0.5);
+ }
+ {
+ typedef std::geometric_distribution<> D;
+ D d(0.75);
+ assert(d.p() == 0.75);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/ctor_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/ctor_param.pass.cpp
new file mode 100644
index 000000000000..5cf93eb4646f
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/ctor_param.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class geometric_distribution
+
+// explicit geometric_distribution(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::geometric_distribution<> D;
+ typedef D::param_type P;
+ P p(0.25);
+ D d(p);
+ assert(d.p() == 0.25);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eq.pass.cpp
new file mode 100644
index 000000000000..38d423bb5f76
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eq.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class geometric_distribution
+
+// bool operator=(const geometric_distribution& x,
+// const geometric_distribution& y);
+// bool operator!(const geometric_distribution& x,
+// const geometric_distribution& y);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::geometric_distribution<> D;
+ D d1(.25);
+ D d2(.25);
+ assert(d1 == d2);
+ }
+ {
+ typedef std::geometric_distribution<> D;
+ D d1(.28);
+ D d2(.25);
+ assert(d1 != d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval.pass.cpp
new file mode 100644
index 000000000000..a8ef221e3b67
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval.pass.cpp
@@ -0,0 +1,274 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class IntType = int>
+// class geometric_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g);
+
+#include <random>
+#include <numeric>
+#include <vector>
+#include <cassert>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x * x;
+}
+
+int main()
+{
+ {
+ typedef std::geometric_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(.03125);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = (1 - d.p()) / d.p();
+ double x_var = x_mean / d.p();
+ double x_skew = (2 - d.p()) / std::sqrt((1 - d.p()));
+ double x_kurtosis = 6 + sqr(d.p()) / (1 - d.p());
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::geometric_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(0.05);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = (1 - d.p()) / d.p();
+ double x_var = x_mean / d.p();
+ double x_skew = (2 - d.p()) / std::sqrt((1 - d.p()));
+ double x_kurtosis = 6 + sqr(d.p()) / (1 - d.p());
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
+ }
+ {
+ typedef std::geometric_distribution<> D;
+ typedef std::minstd_rand G;
+ G g;
+ D d(.25);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = (1 - d.p()) / d.p();
+ double x_var = x_mean / d.p();
+ double x_skew = (2 - d.p()) / std::sqrt((1 - d.p()));
+ double x_kurtosis = 6 + sqr(d.p()) / (1 - d.p());
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+ }
+ {
+ typedef std::geometric_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(0.5);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = (1 - d.p()) / d.p();
+ double x_var = x_mean / d.p();
+ double x_skew = (2 - d.p()) / std::sqrt((1 - d.p()));
+ double x_kurtosis = 6 + sqr(d.p()) / (1 - d.p());
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+ }
+ {
+ typedef std::geometric_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(0.75);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = (1 - d.p()) / d.p();
+ double x_var = x_mean / d.p();
+ double x_skew = (2 - d.p()) / std::sqrt((1 - d.p()));
+ double x_kurtosis = 6 + sqr(d.p()) / (1 - d.p());
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+ }
+ {
+ typedef std::geometric_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(0.96875);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = (1 - d.p()) / d.p();
+ double x_var = x_mean / d.p();
+ double x_skew = (2 - d.p()) / std::sqrt((1 - d.p()));
+ double x_kurtosis = 6 + sqr(d.p()) / (1 - d.p());
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval_param.pass.cpp
new file mode 100644
index 000000000000..91dea8aa1337
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval_param.pass.cpp
@@ -0,0 +1,160 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class IntType = int>
+// class geometric_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
+
+#include <random>
+#include <numeric>
+#include <vector>
+#include <cassert>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x * x;
+}
+
+int main()
+{
+ {
+ typedef std::geometric_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(.75);
+ P p(.03125);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = (1 - p.p()) / p.p();
+ double x_var = x_mean / p.p();
+ double x_skew = (2 - p.p()) / std::sqrt((1 - p.p()));
+ double x_kurtosis = 6 + sqr(p.p()) / (1 - p.p());
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::geometric_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(.75);
+ P p(.25);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = (1 - p.p()) / p.p();
+ double x_var = x_mean / p.p();
+ double x_skew = (2 - p.p()) / std::sqrt((1 - p.p()));
+ double x_kurtosis = 6 + sqr(p.p()) / (1 - p.p());
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
+ }
+ {
+ typedef std::geometric_distribution<> D;
+ typedef D::param_type P;
+ typedef std::minstd_rand G;
+ G g;
+ D d(.5);
+ P p(.75);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = (1 - p.p()) / p.p();
+ double x_var = x_mean / p.p();
+ double x_skew = (2 - p.p()) / std::sqrt((1 - p.p()));
+ double x_kurtosis = 6 + sqr(p.p()) / (1 - p.p());
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/get_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/get_param.pass.cpp
new file mode 100644
index 000000000000..00797a119968
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/get_param.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class geometric_distribution
+
+// param_type param() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::geometric_distribution<> D;
+ typedef D::param_type P;
+ P p(.125);
+ D d(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/io.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/io.pass.cpp
new file mode 100644
index 000000000000..3e3752af7b13
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/io.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class geometric_distribution
+
+// template <class charT, class traits>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& os,
+// const geometric_distribution& x);
+//
+// template <class charT, class traits>
+// basic_istream<charT, traits>&
+// operator>>(basic_istream<charT, traits>& is,
+// geometric_distribution& x);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::geometric_distribution<> D;
+ D d1(.25);
+ std::ostringstream os;
+ os << d1;
+ std::istringstream is(os.str());
+ D d2;
+ is >> d2;
+ assert(d1 == d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/max.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/max.pass.cpp
new file mode 100644
index 000000000000..b381bc438ad8
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/max.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class geometric_distribution
+
+// result_type max() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::geometric_distribution<> D;
+ D d(.25);
+ assert(d.max() == std::numeric_limits<int>::max());
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/min.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/min.pass.cpp
new file mode 100644
index 000000000000..56b75a7f8666
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/min.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class geometric_distribution
+
+// result_type min() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::geometric_distribution<> D;
+ D d(.5);
+ assert(d.min() == 0);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/param_assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/param_assign.pass.cpp
new file mode 100644
index 000000000000..98b84d59ab4d
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/param_assign.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class geometric_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::geometric_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p0(.7);
+ param_type p;
+ p = p0;
+ assert(p.p() == .7);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/param_copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/param_copy.pass.cpp
new file mode 100644
index 000000000000..4397aecfb39c
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/param_copy.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class geometric_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::geometric_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p0(.125);
+ param_type p = p0;
+ assert(p.p() == .125);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/param_ctor.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/param_ctor.pass.cpp
new file mode 100644
index 000000000000..c78525fea303
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/param_ctor.pass.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class geometric_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::geometric_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p;
+ assert(p.p() == 0.5);
+ }
+ {
+ typedef std::geometric_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p(0.25);
+ assert(p.p() == 0.25);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/param_eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/param_eq.pass.cpp
new file mode 100644
index 000000000000..374f2b0b8e97
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/param_eq.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class geometric_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::geometric_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p1(0.75);
+ param_type p2(0.75);
+ assert(p1 == p2);
+ }
+ {
+ typedef std::geometric_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p1(0.75);
+ param_type p2(0.5);
+ assert(p1 != p2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/param_types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/param_types.pass.cpp
new file mode 100644
index 000000000000..33a4c6fff6ca
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/param_types.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class geometric_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::geometric_distribution<> D;
+ typedef D::param_type param_type;
+ typedef param_type::distribution_type distribution_type;
+ static_assert((std::is_same<D, distribution_type>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/set_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/set_param.pass.cpp
new file mode 100644
index 000000000000..e8aee01fbea8
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/set_param.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class geometric_distribution
+
+// void param(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::geometric_distribution<> D;
+ typedef D::param_type P;
+ P p(0.25);
+ D d(0.75);
+ d.param(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/types.pass.cpp
new file mode 100644
index 000000000000..367e3f9871ef
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/types.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class geometric_distribution
+// {
+// typedef bool result_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::geometric_distribution<> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, int>::value), "");
+ }
+ {
+ typedef std::geometric_distribution<long> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, long>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/assign.pass.cpp
new file mode 100644
index 000000000000..f62c52eca851
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/assign.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class negative_binomial_distribution
+
+// negative_binomial_distribution& operator=(const negative_binomial_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::negative_binomial_distribution<> D;
+ D d1(2, 0.75);
+ D d2;
+ assert(d1 != d2);
+ d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/copy.pass.cpp
new file mode 100644
index 000000000000..37c003d353e3
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/copy.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class negative_binomial_distribution
+
+// negative_binomial_distribution(const negative_binomial_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::negative_binomial_distribution<> D;
+ D d1(2, 0.75);
+ D d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/ctor_int_double.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/ctor_int_double.pass.cpp
new file mode 100644
index 000000000000..babf1d464a40
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/ctor_int_double.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class negative_binomial_distribution
+
+// explicit negative_binomial_distribution(IntType t = 1, double p = 0.5);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::negative_binomial_distribution<> D;
+ D d;
+ assert(d.k() == 1);
+ assert(d.p() == 0.5);
+ }
+ {
+ typedef std::negative_binomial_distribution<> D;
+ D d(3);
+ assert(d.k() == 3);
+ assert(d.p() == 0.5);
+ }
+ {
+ typedef std::negative_binomial_distribution<> D;
+ D d(3, 0.75);
+ assert(d.k() == 3);
+ assert(d.p() == 0.75);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/ctor_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/ctor_param.pass.cpp
new file mode 100644
index 000000000000..109a47e87183
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/ctor_param.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class negative_binomial_distribution
+
+// explicit negative_binomial_distribution(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::negative_binomial_distribution<> D;
+ typedef D::param_type P;
+ P p(5, 0.25);
+ D d(p);
+ assert(d.k() == 5);
+ assert(d.p() == 0.25);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eq.pass.cpp
new file mode 100644
index 000000000000..0bf34eed6db9
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eq.pass.cpp
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class negative_binomial_distribution
+
+// bool operator=(const negative_binomial_distribution& x,
+// const negative_binomial_distribution& y);
+// bool operator!(const negative_binomial_distribution& x,
+// const negative_binomial_distribution& y);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::negative_binomial_distribution<> D;
+ D d1(3, .25);
+ D d2(3, .25);
+ assert(d1 == d2);
+ }
+ {
+ typedef std::negative_binomial_distribution<> D;
+ D d1(3, .28);
+ D d2(3, .25);
+ assert(d1 != d2);
+ }
+ {
+ typedef std::negative_binomial_distribution<> D;
+ D d1(3, .25);
+ D d2(4, .25);
+ assert(d1 != d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval.pass.cpp
new file mode 100644
index 000000000000..853161e9f9b7
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval.pass.cpp
@@ -0,0 +1,272 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class IntType = int>
+// class negative_binomial_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g);
+
+#include <random>
+#include <numeric>
+#include <vector>
+#include <cassert>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x * x;
+}
+
+int main()
+{
+ {
+ typedef std::negative_binomial_distribution<> D;
+ typedef std::minstd_rand G;
+ G g;
+ D d(5, .25);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.k() * (1 - d.p()) / d.p();
+ double x_var = x_mean / d.p();
+ double x_skew = (2 - d.p()) / std::sqrt(d.k() * (1 - d.p()));
+ double x_kurtosis = 6. / d.k() + sqr(d.p()) / (d.k() * (1 - d.p()));
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+ }
+ {
+ typedef std::negative_binomial_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(30, .03125);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.k() * (1 - d.p()) / d.p();
+ double x_var = x_mean / d.p();
+ double x_skew = (2 - d.p()) / std::sqrt(d.k() * (1 - d.p()));
+ double x_kurtosis = 6. / d.k() + sqr(d.p()) / (d.k() * (1 - d.p()));
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::negative_binomial_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(40, .25);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.k() * (1 - d.p()) / d.p();
+ double x_var = x_mean / d.p();
+ double x_skew = (2 - d.p()) / std::sqrt(d.k() * (1 - d.p()));
+ double x_kurtosis = 6. / d.k() + sqr(d.p()) / (d.k() * (1 - d.p()));
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
+ }
+ {
+ typedef std::negative_binomial_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(40, 1);
+ const int N = 1000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.k() * (1 - d.p()) / d.p();
+ double x_var = x_mean / d.p();
+ double x_skew = (2 - d.p()) / std::sqrt(d.k() * (1 - d.p()));
+ double x_kurtosis = 6. / d.k() + sqr(d.p()) / (d.k() * (1 - d.p()));
+ assert(mean == x_mean);
+ assert(var == x_var);
+ }
+ {
+ typedef std::negative_binomial_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(400, 0.5);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.k() * (1 - d.p()) / d.p();
+ double x_var = x_mean / d.p();
+ double x_skew = (2 - d.p()) / std::sqrt(d.k() * (1 - d.p()));
+ double x_kurtosis = 6. / d.k() + sqr(d.p()) / (d.k() * (1 - d.p()));
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.04);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.05);
+ }
+ {
+ typedef std::negative_binomial_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(1, 0.05);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.k() * (1 - d.p()) / d.p();
+ double x_var = x_mean / d.p();
+ double x_skew = (2 - d.p()) / std::sqrt(d.k() * (1 - d.p()));
+ double x_kurtosis = 6. / d.k() + sqr(d.p()) / (d.k() * (1 - d.p()));
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval_param.pass.cpp
new file mode 100644
index 000000000000..f2f2a07879e2
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval_param.pass.cpp
@@ -0,0 +1,160 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class IntType = int>
+// class negative_binomial_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
+
+#include <random>
+#include <numeric>
+#include <vector>
+#include <cassert>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x * x;
+}
+
+int main()
+{
+ {
+ typedef std::negative_binomial_distribution<> D;
+ typedef D::param_type P;
+ typedef std::minstd_rand G;
+ G g;
+ D d(16, .75);
+ P p(5, .75);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = p.k() * (1 - p.p()) / p.p();
+ double x_var = x_mean / p.p();
+ double x_skew = (2 - p.p()) / std::sqrt(p.k() * (1 - p.p()));
+ double x_kurtosis = 6. / p.k() + sqr(p.p()) / (p.k() * (1 - p.p()));
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::negative_binomial_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(16, .75);
+ P p(30, .03125);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = p.k() * (1 - p.p()) / p.p();
+ double x_var = x_mean / p.p();
+ double x_skew = (2 - p.p()) / std::sqrt(p.k() * (1 - p.p()));
+ double x_kurtosis = 6. / p.k() + sqr(p.p()) / (p.k() * (1 - p.p()));
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::negative_binomial_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(16, .75);
+ P p(40, .25);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = p.k() * (1 - p.p()) / p.p();
+ double x_var = x_mean / p.p();
+ double x_skew = (2 - p.p()) / std::sqrt(p.k() * (1 - p.p()));
+ double x_kurtosis = 6. / p.k() + sqr(p.p()) / (p.k() * (1 - p.p()));
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/get_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/get_param.pass.cpp
new file mode 100644
index 000000000000..65f4a978cb05
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/get_param.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class negative_binomial_distribution
+
+// param_type param() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::negative_binomial_distribution<> D;
+ typedef D::param_type P;
+ P p(5, .125);
+ D d(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/io.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/io.pass.cpp
new file mode 100644
index 000000000000..da5e8af616ec
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/io.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class negative_binomial_distribution
+
+// template <class charT, class traits>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& os,
+// const negative_binomial_distribution& x);
+//
+// template <class charT, class traits>
+// basic_istream<charT, traits>&
+// operator>>(basic_istream<charT, traits>& is,
+// negative_binomial_distribution& x);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::negative_binomial_distribution<> D;
+ D d1(7, .25);
+ std::ostringstream os;
+ os << d1;
+ std::istringstream is(os.str());
+ D d2;
+ is >> d2;
+ assert(d1 == d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/max.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/max.pass.cpp
new file mode 100644
index 000000000000..2fe7184e6ec9
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/max.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class negative_binomial_distribution
+
+// result_type max() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::negative_binomial_distribution<> D;
+ D d(4, .25);
+ assert(d.max() == std::numeric_limits<int>::max());
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/min.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/min.pass.cpp
new file mode 100644
index 000000000000..15bec5a7dc6a
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/min.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class negative_binomial_distribution
+
+// result_type min() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::negative_binomial_distribution<> D;
+ D d(4, .5);
+ assert(d.min() == 0);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/param_assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/param_assign.pass.cpp
new file mode 100644
index 000000000000..dc4d35c700ae
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/param_assign.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class negative_binomial_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::negative_binomial_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p0(6, .7);
+ param_type p;
+ p = p0;
+ assert(p.k() == 6);
+ assert(p.p() == .7);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/param_copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/param_copy.pass.cpp
new file mode 100644
index 000000000000..ec5af5b85030
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/param_copy.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class negative_binomial_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::negative_binomial_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p0(10, .125);
+ param_type p = p0;
+ assert(p.k() == 10);
+ assert(p.p() == .125);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/param_ctor.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/param_ctor.pass.cpp
new file mode 100644
index 000000000000..6d713ce71b23
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/param_ctor.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class negative_binomial_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::negative_binomial_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p;
+ assert(p.k() == 1);
+ assert(p.p() == 0.5);
+ }
+ {
+ typedef std::negative_binomial_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p(10);
+ assert(p.k() == 10);
+ assert(p.p() == 0.5);
+ }
+ {
+ typedef std::negative_binomial_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p(10, 0.25);
+ assert(p.k() == 10);
+ assert(p.p() == 0.25);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/param_eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/param_eq.pass.cpp
new file mode 100644
index 000000000000..b0f81cdfa7a0
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/param_eq.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class negative_binomial_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::negative_binomial_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p1(3, 0.75);
+ param_type p2(3, 0.75);
+ assert(p1 == p2);
+ }
+ {
+ typedef std::negative_binomial_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p1(3, 0.75);
+ param_type p2(3, 0.5);
+ assert(p1 != p2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/param_types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/param_types.pass.cpp
new file mode 100644
index 000000000000..282ca190c232
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/param_types.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class negative_binomial_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::negative_binomial_distribution<> D;
+ typedef D::param_type param_type;
+ typedef param_type::distribution_type distribution_type;
+ static_assert((std::is_same<D, distribution_type>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/set_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/set_param.pass.cpp
new file mode 100644
index 000000000000..05c204f5c649
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/set_param.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class negative_binomial_distribution
+
+// void param(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::negative_binomial_distribution<> D;
+ typedef D::param_type P;
+ P p(10, 0.25);
+ D d(8, 0.75);
+ d.param(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/types.pass.cpp
new file mode 100644
index 000000000000..149f5075236d
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/types.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class negative_binomial_distribution
+// {
+// typedef bool result_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::negative_binomial_distribution<> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, int>::value), "");
+ }
+ {
+ typedef std::negative_binomial_distribution<long> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, long>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/nothing_to_do.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..b58f5c55b643
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/assign.pass.cpp
new file mode 100644
index 000000000000..3003e0db94d1
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/assign.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class cauchy_distribution
+
+// cauchy_distribution& operator=(const cauchy_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::cauchy_distribution<> D;
+ D d1(.5, 2);
+ D d2;
+ assert(d1 != d2);
+ d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/copy.pass.cpp
new file mode 100644
index 000000000000..032191493e54
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/copy.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class cauchy_distribution
+
+// cauchy_distribution(const cauchy_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::cauchy_distribution<> D;
+ D d1(.5, 1.75);
+ D d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/ctor_double_double.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/ctor_double_double.pass.cpp
new file mode 100644
index 000000000000..a0406b026b96
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/ctor_double_double.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class cauchy_distribution
+
+// explicit cauchy_distribution(result_type a = 0, result_type b = 1);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::cauchy_distribution<> D;
+ D d;
+ assert(d.a() == 0);
+ assert(d.b() == 1);
+ }
+ {
+ typedef std::cauchy_distribution<> D;
+ D d(14.5);
+ assert(d.a() == 14.5);
+ assert(d.b() == 1);
+ }
+ {
+ typedef std::cauchy_distribution<> D;
+ D d(14.5, 5.25);
+ assert(d.a() == 14.5);
+ assert(d.b() == 5.25);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/ctor_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/ctor_param.pass.cpp
new file mode 100644
index 000000000000..0973b60a7248
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/ctor_param.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class cauchy_distribution
+
+// explicit cauchy_distribution(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::cauchy_distribution<> D;
+ typedef D::param_type P;
+ P p(0.25, 10);
+ D d(p);
+ assert(d.a() == 0.25);
+ assert(d.b() == 10);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/eq.pass.cpp
new file mode 100644
index 000000000000..005e141b46c0
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/eq.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class cauchy_distribution
+
+// bool operator=(const cauchy_distribution& x,
+// const cauchy_distribution& y);
+// bool operator!(const cauchy_distribution& x,
+// const cauchy_distribution& y);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::cauchy_distribution<> D;
+ D d1(2.5, 4);
+ D d2(2.5, 4);
+ assert(d1 == d2);
+ }
+ {
+ typedef std::cauchy_distribution<> D;
+ D d1(2.5, 4);
+ D d2(2.5, 4.5);
+ assert(d1 != d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/eval.pass.cpp
new file mode 100644
index 000000000000..d70d8f072c39
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/eval.pass.cpp
@@ -0,0 +1,80 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class RealType = double>
+// class cauchy_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g);
+
+#include <random>
+#include <cassert>
+#include <vector>
+#include <algorithm>
+
+double
+f(double x, double a, double b)
+{
+ return 1/3.1415926535897932 * std::atan((x - a)/b) + .5;
+}
+
+int main()
+{
+ {
+ typedef std::cauchy_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ const double a = 10;
+ const double b = .5;
+ D d(a, b);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ u.push_back(d(g));
+ std::sort(u.begin(), u.end());
+ for (int i = 0; i < N; ++i)
+ assert(std::abs(f(u[i], a, b) - double(i)/N) < .001);
+ }
+ {
+ typedef std::cauchy_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ const double a = -1.5;
+ const double b = 1;
+ D d(a, b);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ u.push_back(d(g));
+ std::sort(u.begin(), u.end());
+ for (int i = 0; i < N; ++i)
+ assert(std::abs(f(u[i], a, b) - double(i)/N) < .001);
+ }
+ {
+ typedef std::cauchy_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ const double a = .5;
+ const double b = 2;
+ D d(a, b);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ u.push_back(d(g));
+ std::sort(u.begin(), u.end());
+ for (int i = 0; i < N; ++i)
+ assert(std::abs(f(u[i], a, b) - double(i)/N) < .001);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/eval_param.pass.cpp
new file mode 100644
index 000000000000..318c29e7694e
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/eval_param.pass.cpp
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class RealType = double>
+// class cauchy_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
+
+#include <random>
+#include <cassert>
+#include <vector>
+#include <algorithm>
+
+double
+f(double x, double a, double b)
+{
+ return 1/3.1415926535897932 * std::atan((x - a)/b) + .5;
+}
+
+int main()
+{
+ {
+ typedef std::cauchy_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ const double a = 10;
+ const double b = .5;
+ D d;
+ P p(a, b);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ u.push_back(d(g, p));
+ std::sort(u.begin(), u.end());
+ for (int i = 0; i < N; ++i)
+ assert(std::abs(f(u[i], a, b) - double(i)/N) < .001);
+ }
+ {
+ typedef std::cauchy_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ const double a = -1.5;
+ const double b = 1;
+ D d;
+ P p(a, b);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ u.push_back(d(g, p));
+ std::sort(u.begin(), u.end());
+ for (int i = 0; i < N; ++i)
+ assert(std::abs(f(u[i], a, b) - double(i)/N) < .001);
+ }
+ {
+ typedef std::cauchy_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ const double a = .5;
+ const double b = 2;
+ D d;
+ P p(a, b);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ u.push_back(d(g, p));
+ std::sort(u.begin(), u.end());
+ for (int i = 0; i < N; ++i)
+ assert(std::abs(f(u[i], a, b) - double(i)/N) < .001);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/get_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/get_param.pass.cpp
new file mode 100644
index 000000000000..0e2d6b049f67
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/get_param.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class cauchy_distribution
+
+// param_type param() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::cauchy_distribution<> D;
+ typedef D::param_type P;
+ P p(.125, .5);
+ D d(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/io.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/io.pass.cpp
new file mode 100644
index 000000000000..ca53792c6af8
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/io.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class cauchy_distribution
+
+// template <class CharT, class Traits, class RealType>
+// basic_ostream<CharT, Traits>&
+// operator<<(basic_ostream<CharT, Traits>& os,
+// const cauchy_distribution<RealType>& x);
+
+// template <class CharT, class Traits, class RealType>
+// basic_istream<CharT, Traits>&
+// operator>>(basic_istream<CharT, Traits>& is,
+// cauchy_distribution<RealType>& x);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::cauchy_distribution<> D;
+ D d1(7.5, 5.5);
+ std::ostringstream os;
+ os << d1;
+ std::istringstream is(os.str());
+ D d2;
+ is >> d2;
+ assert(d1 == d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/max.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/max.pass.cpp
new file mode 100644
index 000000000000..263c1773a8f0
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/max.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class cauchy_distribution
+
+// result_type max() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::cauchy_distribution<> D;
+ D d(5, .25);
+ D::result_type m = d.max();
+ assert(m == INFINITY);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/min.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/min.pass.cpp
new file mode 100644
index 000000000000..0d52179ae7e3
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/min.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class cauchy_distribution
+
+// result_type min() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::cauchy_distribution<> D;
+ D d(.5, .5);
+ assert(d.min() == -INFINITY);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/param_assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/param_assign.pass.cpp
new file mode 100644
index 000000000000..f8e0852834d3
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/param_assign.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class cauchy_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::cauchy_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p0(.75, 6);
+ param_type p;
+ p = p0;
+ assert(p.a() == .75);
+ assert(p.b() == 6);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/param_copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/param_copy.pass.cpp
new file mode 100644
index 000000000000..28ef06827757
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/param_copy.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class cauchy_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::cauchy_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p0(10, .125);
+ param_type p = p0;
+ assert(p.a() == 10);
+ assert(p.b() == .125);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/param_ctor.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/param_ctor.pass.cpp
new file mode 100644
index 000000000000..8ae5137aa3af
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/param_ctor.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class cauchy_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::cauchy_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p;
+ assert(p.a() == 0);
+ assert(p.b() == 1);
+ }
+ {
+ typedef std::cauchy_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p(10);
+ assert(p.a() == 10);
+ assert(p.b() == 1);
+ }
+ {
+ typedef std::cauchy_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p(10, 5);
+ assert(p.a() == 10);
+ assert(p.b() == 5);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/param_eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/param_eq.pass.cpp
new file mode 100644
index 000000000000..6210321fb343
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/param_eq.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class cauchy_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::cauchy_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p1(0.75, .5);
+ param_type p2(0.75, .5);
+ assert(p1 == p2);
+ }
+ {
+ typedef std::cauchy_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p1(0.75, .5);
+ param_type p2(0.5, .5);
+ assert(p1 != p2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/param_types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/param_types.pass.cpp
new file mode 100644
index 000000000000..56b1f6f91501
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/param_types.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class cauchy_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::cauchy_distribution<> D;
+ typedef D::param_type param_type;
+ typedef param_type::distribution_type distribution_type;
+ static_assert((std::is_same<D, distribution_type>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/set_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/set_param.pass.cpp
new file mode 100644
index 000000000000..201ec60b00e3
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/set_param.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class cauchy_distribution;
+
+// void param(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::cauchy_distribution<> D;
+ typedef D::param_type P;
+ P p(0.25, 5.5);
+ D d(0.75, 4);
+ d.param(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/types.pass.cpp
new file mode 100644
index 000000000000..919a7b1b65b2
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/types.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class cauchy_distribution
+// {
+// public:
+// // types
+// typedef RealType result_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::cauchy_distribution<> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, double>::value), "");
+ }
+ {
+ typedef std::cauchy_distribution<float> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, float>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/assign.pass.cpp
new file mode 100644
index 000000000000..0c3a0aed2df8
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/assign.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class chi_squared_distribution
+
+// chi_squared_distribution& operator=(const chi_squared_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::chi_squared_distribution<> D;
+ D d1(20.75);
+ D d2;
+ assert(d1 != d2);
+ d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/copy.pass.cpp
new file mode 100644
index 000000000000..9496184d4333
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/copy.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class chi_squared_distribution
+
+// chi_squared_distribution(const chi_squared_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::chi_squared_distribution<> D;
+ D d1(21.75);
+ D d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/ctor_double.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/ctor_double.pass.cpp
new file mode 100644
index 000000000000..27401d91e10c
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/ctor_double.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class chi_squared_distribution
+
+// explicit chi_squared_distribution(result_type alpha = 0, result_type beta = 1);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::chi_squared_distribution<> D;
+ D d;
+ assert(d.n() == 1);
+ }
+ {
+ typedef std::chi_squared_distribution<> D;
+ D d(14.5);
+ assert(d.n() == 14.5);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/ctor_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/ctor_param.pass.cpp
new file mode 100644
index 000000000000..afd5aa91c7cd
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/ctor_param.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class chi_squared_distribution
+
+// explicit chi_squared_distribution(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::chi_squared_distribution<> D;
+ typedef D::param_type P;
+ P p(0.25);
+ D d(p);
+ assert(d.n() == 0.25);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eq.pass.cpp
new file mode 100644
index 000000000000..88630b0cf521
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eq.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class chi_squared_distribution
+
+// bool operator=(const chi_squared_distribution& x,
+// const chi_squared_distribution& y);
+// bool operator!(const chi_squared_distribution& x,
+// const chi_squared_distribution& y);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::chi_squared_distribution<> D;
+ D d1(2.5);
+ D d2(2.5);
+ assert(d1 == d2);
+ }
+ {
+ typedef std::chi_squared_distribution<> D;
+ D d1(4);
+ D d2(4.5);
+ assert(d1 != d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval.pass.cpp
new file mode 100644
index 000000000000..6fbdd93f8ffd
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval.pass.cpp
@@ -0,0 +1,154 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class RealType = double>
+// class chi_squared_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g);
+
+#include <random>
+#include <cassert>
+#include <vector>
+#include <numeric>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x * x;
+}
+
+int main()
+{
+ {
+ typedef std::chi_squared_distribution<> D;
+ typedef D::param_type P;
+ typedef std::minstd_rand G;
+ G g;
+ D d(0.5);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() < v);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.n();
+ double x_var = 2 * d.n();
+ double x_skew = std::sqrt(8 / d.n());
+ double x_kurtosis = 12 / d.n();
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::chi_squared_distribution<> D;
+ typedef D::param_type P;
+ typedef std::minstd_rand G;
+ G g;
+ D d(1);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() < v);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.n();
+ double x_var = 2 * d.n();
+ double x_skew = std::sqrt(8 / d.n());
+ double x_kurtosis = 12 / d.n();
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::chi_squared_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(2);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() < v);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.n();
+ double x_var = 2 * d.n();
+ double x_skew = std::sqrt(8 / d.n());
+ double x_kurtosis = 12 / d.n();
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval_param.pass.cpp
new file mode 100644
index 000000000000..548848d19f3e
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval_param.pass.cpp
@@ -0,0 +1,157 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class RealType = double>
+// class chi_squared_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
+
+#include <random>
+#include <cassert>
+#include <vector>
+#include <numeric>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x * x;
+}
+
+int main()
+{
+ {
+ typedef std::chi_squared_distribution<> D;
+ typedef D::param_type P;
+ typedef std::minstd_rand G;
+ G g;
+ D d(0.5);
+ P p(1);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ assert(d.min() < v);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = p.n();
+ double x_var = 2 * p.n();
+ double x_skew = std::sqrt(8 / p.n());
+ double x_kurtosis = 12 / p.n();
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::chi_squared_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(1);
+ P p(2);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ assert(d.min() < v);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = p.n();
+ double x_var = 2 * p.n();
+ double x_skew = std::sqrt(8 / p.n());
+ double x_kurtosis = 12 / p.n();
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::chi_squared_distribution<> D;
+ typedef D::param_type P;
+ typedef std::minstd_rand G;
+ G g;
+ D d(2);
+ P p(.5);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ assert(d.min() < v);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = p.n();
+ double x_var = 2 * p.n();
+ double x_skew = std::sqrt(8 / p.n());
+ double x_kurtosis = 12 / p.n();
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/get_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/get_param.pass.cpp
new file mode 100644
index 000000000000..f12a0519bfca
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/get_param.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class chi_squared_distribution
+
+// param_type param() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::chi_squared_distribution<> D;
+ typedef D::param_type P;
+ P p(.125);
+ D d(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/io.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/io.pass.cpp
new file mode 100644
index 000000000000..de16fa1e1eb7
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/io.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class chi_squared_distribution
+
+// template <class CharT, class Traits, class RealType>
+// basic_ostream<CharT, Traits>&
+// operator<<(basic_ostream<CharT, Traits>& os,
+// const chi_squared_distribution<RealType>& x);
+
+// template <class CharT, class Traits, class RealType>
+// basic_istream<CharT, Traits>&
+// operator>>(basic_istream<CharT, Traits>& is,
+// chi_squared_distribution<RealType>& x);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::chi_squared_distribution<> D;
+ D d1(7);
+ std::ostringstream os;
+ os << d1;
+ std::istringstream is(os.str());
+ D d2;
+ is >> d2;
+ assert(d1 == d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/max.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/max.pass.cpp
new file mode 100644
index 000000000000..adf4f96ebec0
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/max.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class chi_squared_distribution
+
+// result_type max() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::chi_squared_distribution<> D;
+ D d(5);
+ D::result_type m = d.max();
+ assert(m == INFINITY);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/min.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/min.pass.cpp
new file mode 100644
index 000000000000..4e51590bbce6
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/min.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class chi_squared_distribution
+
+// result_type min() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::chi_squared_distribution<> D;
+ D d(.5);
+ assert(d.min() == 0);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/param_assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/param_assign.pass.cpp
new file mode 100644
index 000000000000..85730f619187
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/param_assign.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class chi_squared_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::chi_squared_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p0(.75);
+ param_type p;
+ p = p0;
+ assert(p.n() == .75);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/param_copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/param_copy.pass.cpp
new file mode 100644
index 000000000000..3ddb02b72713
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/param_copy.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class chi_squared_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::chi_squared_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p0(10);
+ param_type p = p0;
+ assert(p.n() == 10);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/param_ctor.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/param_ctor.pass.cpp
new file mode 100644
index 000000000000..34d8651156b6
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/param_ctor.pass.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class chi_squared_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::chi_squared_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p;
+ assert(p.n() == 1);
+ }
+ {
+ typedef std::chi_squared_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p(10);
+ assert(p.n() == 10);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/param_eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/param_eq.pass.cpp
new file mode 100644
index 000000000000..cb738ea858a3
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/param_eq.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class chi_squared_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::chi_squared_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p1(0.75);
+ param_type p2(0.75);
+ assert(p1 == p2);
+ }
+ {
+ typedef std::chi_squared_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p1(0.75);
+ param_type p2(0.5);
+ assert(p1 != p2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/param_types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/param_types.pass.cpp
new file mode 100644
index 000000000000..257016b3c332
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/param_types.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class chi_squared_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::chi_squared_distribution<> D;
+ typedef D::param_type param_type;
+ typedef param_type::distribution_type distribution_type;
+ static_assert((std::is_same<D, distribution_type>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/set_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/set_param.pass.cpp
new file mode 100644
index 000000000000..a8d4e52b8bb7
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/set_param.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class chi_squared_distribution;
+
+// void param(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::chi_squared_distribution<> D;
+ typedef D::param_type P;
+ P p(0.25);
+ D d(0.75);
+ d.param(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/types.pass.cpp
new file mode 100644
index 000000000000..614da1979ee5
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/types.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class chi_squared_distribution
+// {
+// public:
+// // types
+// typedef RealType result_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::chi_squared_distribution<> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, double>::value), "");
+ }
+ {
+ typedef std::chi_squared_distribution<float> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, float>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/assign.pass.cpp
new file mode 100644
index 000000000000..f5294bdc54b1
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/assign.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class fisher_f_distribution
+
+// fisher_f_distribution& operator=(const fisher_f_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::fisher_f_distribution<> D;
+ D d1(20, 0.75);
+ D d2;
+ assert(d1 != d2);
+ d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/copy.pass.cpp
new file mode 100644
index 000000000000..047d5133583c
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/copy.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class fisher_f_distribution
+
+// fisher_f_distribution(const fisher_f_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::fisher_f_distribution<> D;
+ D d1(20, 1.75);
+ D d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/ctor_double_double.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/ctor_double_double.pass.cpp
new file mode 100644
index 000000000000..1dd628b625aa
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/ctor_double_double.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class fisher_f_distribution
+
+// explicit fisher_f_distribution(result_type alpha = 0, result_type beta = 1);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::fisher_f_distribution<> D;
+ D d;
+ assert(d.m() == 1);
+ assert(d.n() == 1);
+ }
+ {
+ typedef std::fisher_f_distribution<> D;
+ D d(14.5);
+ assert(d.m() == 14.5);
+ assert(d.n() == 1);
+ }
+ {
+ typedef std::fisher_f_distribution<> D;
+ D d(14.5, 5.25);
+ assert(d.m() == 14.5);
+ assert(d.n() == 5.25);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/ctor_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/ctor_param.pass.cpp
new file mode 100644
index 000000000000..83a81cf4068b
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/ctor_param.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class fisher_f_distribution
+
+// explicit fisher_f_distribution(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::fisher_f_distribution<> D;
+ typedef D::param_type P;
+ P p(0.25, 10);
+ D d(p);
+ assert(d.m() == 0.25);
+ assert(d.n() == 10);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eq.pass.cpp
new file mode 100644
index 000000000000..405c906cbdc3
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eq.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class fisher_f_distribution
+
+// bool operator=(const fisher_f_distribution& x,
+// const fisher_f_distribution& y);
+// bool operator!(const fisher_f_distribution& x,
+// const fisher_f_distribution& y);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::fisher_f_distribution<> D;
+ D d1(2.5, 4);
+ D d2(2.5, 4);
+ assert(d1 == d2);
+ }
+ {
+ typedef std::fisher_f_distribution<> D;
+ D d1(2.5, 4);
+ D d2(2.5, 4.5);
+ assert(d1 != d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp
new file mode 100644
index 000000000000..091bbb9bb452
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp
@@ -0,0 +1,106 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class RealType = double>
+// class fisher_f_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g);
+
+#include <random>
+#include <cassert>
+#include <vector>
+#include <algorithm>
+#include <cmath>
+
+double fac(double x)
+{
+ double r = 1;
+ for (; x > 1; --x)
+ r *= x;
+ return r;
+}
+
+double
+I(double x, unsigned a, unsigned b)
+{
+ double r = 0;
+ for (int j = a; j <= a+b-1; ++j)
+ r += fac(a+b-1)/(fac(j) * fac(a + b - 1 - j)) * std::pow(x, j) *
+ std::pow(1-x, a+b-1-j);
+ return r;
+}
+
+double
+f(double x, double m, double n)
+{
+ return I(m * x / (m*x + n), static_cast<unsigned>(m/2), static_cast<unsigned>(n/2));
+}
+
+int main()
+{
+ // Purposefully only testing even integral values of m and n (for now)
+ {
+ typedef std::fisher_f_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(2, 4);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(v >= 0);
+ u.push_back(v);
+ }
+ std::sort(u.begin(), u.end());
+ for (int i = 0; i < N; ++i)
+ assert(std::abs(f(u[i], d.m(), d.n()) - double(i)/N) < .01);
+ }
+ {
+ typedef std::fisher_f_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(4, 2);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(v >= 0);
+ u.push_back(v);
+ }
+ std::sort(u.begin(), u.end());
+ for (int i = 0; i < N; ++i)
+ assert(std::abs(f(u[i], d.m(), d.n()) - double(i)/N) < .01);
+ }
+ {
+ typedef std::fisher_f_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(18, 20);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(v >= 0);
+ u.push_back(v);
+ }
+ std::sort(u.begin(), u.end());
+ for (int i = 0; i < N; ++i)
+ assert(std::abs(f(u[i], d.m(), d.n()) - double(i)/N) < .01);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval_param.pass.cpp
new file mode 100644
index 000000000000..774137154e09
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval_param.pass.cpp
@@ -0,0 +1,109 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class RealType = double>
+// class fisher_f_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
+
+#include <random>
+#include <cassert>
+#include <vector>
+#include <algorithm>
+#include <cmath>
+
+double fac(double x)
+{
+ double r = 1;
+ for (; x > 1; --x)
+ r *= x;
+ return r;
+}
+
+double
+I(double x, unsigned a, unsigned b)
+{
+ double r = 0;
+ for (int j = a; j <= a+b-1; ++j)
+ r += fac(a+b-1)/(fac(j) * fac(a + b - 1 - j)) * std::pow(x, j) *
+ std::pow(1-x, a+b-1-j);
+ return r;
+}
+
+double
+f(double x, double m, double n)
+{
+ return I(m * x / (m*x + n), static_cast<unsigned>(m/2), static_cast<unsigned>(n/2));
+}
+
+int main()
+{
+ // Purposefully only testing even integral values of m and n (for now)
+ {
+ typedef std::fisher_f_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(2, 4);
+ P p(4, 2);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ assert(v >= 0);
+ u.push_back(v);
+ }
+ std::sort(u.begin(), u.end());
+ for (int i = 0; i < N; ++i)
+ assert(std::abs(f(u[i], p.m(), p.n()) - double(i)/N) < .01);
+ }
+ {
+ typedef std::fisher_f_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(4, 2);
+ P p(6, 8);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ assert(v >= 0);
+ u.push_back(v);
+ }
+ std::sort(u.begin(), u.end());
+ for (int i = 0; i < N; ++i)
+ assert(std::abs(f(u[i], p.m(), p.n()) - double(i)/N) < .01);
+ }
+ {
+ typedef std::fisher_f_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(18, 20);
+ P p(16, 14);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ assert(v >= 0);
+ u.push_back(v);
+ }
+ std::sort(u.begin(), u.end());
+ for (int i = 0; i < N; ++i)
+ assert(std::abs(f(u[i], p.m(), p.n()) - double(i)/N) < .01);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/get_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/get_param.pass.cpp
new file mode 100644
index 000000000000..572df9bed67e
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/get_param.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class fisher_f_distribution
+
+// param_type param() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::fisher_f_distribution<> D;
+ typedef D::param_type P;
+ P p(.125, .5);
+ D d(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/io.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/io.pass.cpp
new file mode 100644
index 000000000000..8872a274b2ec
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/io.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class fisher_f_distribution
+
+// template <class CharT, class Traits, class RealType>
+// basic_ostream<CharT, Traits>&
+// operator<<(basic_ostream<CharT, Traits>& os,
+// const fisher_f_distribution<RealType>& x);
+
+// template <class CharT, class Traits, class RealType>
+// basic_istream<CharT, Traits>&
+// operator>>(basic_istream<CharT, Traits>& is,
+// fisher_f_distribution<RealType>& x);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::fisher_f_distribution<> D;
+ D d1(7, 5);
+ std::ostringstream os;
+ os << d1;
+ std::istringstream is(os.str());
+ D d2;
+ is >> d2;
+ assert(d1 == d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/max.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/max.pass.cpp
new file mode 100644
index 000000000000..dfdbd5d7df8d
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/max.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class fisher_f_distribution
+
+// result_type max() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::fisher_f_distribution<> D;
+ D d(5, .25);
+ D::result_type m = d.max();
+ assert(m == INFINITY);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/min.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/min.pass.cpp
new file mode 100644
index 000000000000..bd4c5d1a6fcf
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/min.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class fisher_f_distribution
+
+// result_type min() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::fisher_f_distribution<> D;
+ D d(.5, .5);
+ assert(d.min() == 0);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_assign.pass.cpp
new file mode 100644
index 000000000000..ea44645e66f9
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_assign.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class fisher_f_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::fisher_f_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p0(.75, 6);
+ param_type p;
+ p = p0;
+ assert(p.m() == .75);
+ assert(p.n() == 6);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_copy.pass.cpp
new file mode 100644
index 000000000000..d6ce53ae136c
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_copy.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class fisher_f_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::fisher_f_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p0(10, .125);
+ param_type p = p0;
+ assert(p.m() == 10);
+ assert(p.n() == .125);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_ctor.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_ctor.pass.cpp
new file mode 100644
index 000000000000..1ab9138eb2fb
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_ctor.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class fisher_f_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::fisher_f_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p;
+ assert(p.m() == 1);
+ assert(p.n() == 1);
+ }
+ {
+ typedef std::fisher_f_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p(10);
+ assert(p.m() == 10);
+ assert(p.n() == 1);
+ }
+ {
+ typedef std::fisher_f_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p(10, 5);
+ assert(p.m() == 10);
+ assert(p.n() == 5);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_eq.pass.cpp
new file mode 100644
index 000000000000..16eea408a8cf
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_eq.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class fisher_f_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::fisher_f_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p1(0.75, .5);
+ param_type p2(0.75, .5);
+ assert(p1 == p2);
+ }
+ {
+ typedef std::fisher_f_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p1(0.75, .5);
+ param_type p2(0.5, .5);
+ assert(p1 != p2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_types.pass.cpp
new file mode 100644
index 000000000000..8391eedd23ac
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_types.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class fisher_f_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::fisher_f_distribution<> D;
+ typedef D::param_type param_type;
+ typedef param_type::distribution_type distribution_type;
+ static_assert((std::is_same<D, distribution_type>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/set_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/set_param.pass.cpp
new file mode 100644
index 000000000000..a7a1af662bfc
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/set_param.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class fisher_f_distribution;
+
+// void param(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::fisher_f_distribution<> D;
+ typedef D::param_type P;
+ P p(0.25, 5.5);
+ D d(0.75, 4);
+ d.param(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/types.pass.cpp
new file mode 100644
index 000000000000..b765725d1c58
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/types.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class fisher_f_distribution
+// {
+// public:
+// // types
+// typedef RealType result_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::fisher_f_distribution<> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, double>::value), "");
+ }
+ {
+ typedef std::fisher_f_distribution<float> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, float>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/assign.pass.cpp
new file mode 100644
index 000000000000..4da6451d9bfc
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/assign.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class lognormal_distribution
+
+// lognormal_distribution& operator=(const lognormal_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::lognormal_distribution<> D;
+ D d1(20, 0.75);
+ D d2;
+ assert(d1 != d2);
+ d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/copy.pass.cpp
new file mode 100644
index 000000000000..777f4a1ac9d5
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/copy.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class lognormal_distribution
+
+// lognormal_distribution(const lognormal_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::lognormal_distribution<> D;
+ D d1(20, 1.75);
+ D d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/ctor_double_double.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/ctor_double_double.pass.cpp
new file mode 100644
index 000000000000..39d53393dd29
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/ctor_double_double.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class lognormal_distribution
+
+// explicit lognormal_distribution(result_type mean = 0, result_type stddev = 1);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::lognormal_distribution<> D;
+ D d;
+ assert(d.m() == 0);
+ assert(d.s() == 1);
+ }
+ {
+ typedef std::lognormal_distribution<> D;
+ D d(14.5);
+ assert(d.m() == 14.5);
+ assert(d.s() == 1);
+ }
+ {
+ typedef std::lognormal_distribution<> D;
+ D d(14.5, 5.25);
+ assert(d.m() == 14.5);
+ assert(d.s() == 5.25);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/ctor_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/ctor_param.pass.cpp
new file mode 100644
index 000000000000..f16567788066
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/ctor_param.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class lognormal_distribution
+
+// explicit lognormal_distribution(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::lognormal_distribution<> D;
+ typedef D::param_type P;
+ P p(0.25, 10);
+ D d(p);
+ assert(d.m() == 0.25);
+ assert(d.s() == 10);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eq.pass.cpp
new file mode 100644
index 000000000000..5fee0fd4ce17
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eq.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class lognormal_distribution
+
+// bool operator=(const lognormal_distribution& x,
+// const lognormal_distribution& y);
+// bool operator!(const lognormal_distribution& x,
+// const lognormal_distribution& y);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::lognormal_distribution<> D;
+ D d1(2.5, 4);
+ D d2(2.5, 4);
+ assert(d1 == d2);
+ }
+ {
+ typedef std::lognormal_distribution<> D;
+ D d1(2.5, 4);
+ D d2(2.5, 4.5);
+ assert(d1 != d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval.pass.cpp
new file mode 100644
index 000000000000..9b111cced8a8
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval.pass.cpp
@@ -0,0 +1,244 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class RealType = double>
+// class lognormal_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g);
+
+#include <random>
+#include <cassert>
+#include <vector>
+#include <numeric>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x * x;
+}
+
+int main()
+{
+ {
+ typedef std::lognormal_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(-1./8192, 0.015625);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(v > 0);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = std::exp(d.m() + sqr(d.s())/2);
+ double x_var = (std::exp(sqr(d.s())) - 1) * std::exp(2*d.m() + sqr(d.s()));
+ double x_skew = (std::exp(sqr(d.s())) + 2) *
+ std::sqrt((std::exp(sqr(d.s())) - 1));
+ double x_kurtosis = std::exp(4*sqr(d.s())) + 2*std::exp(3*sqr(d.s())) +
+ 3*std::exp(2*sqr(d.s())) - 6;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.05);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.25);
+ }
+ {
+ typedef std::lognormal_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(-1./32, 0.25);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(v > 0);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = std::exp(d.m() + sqr(d.s())/2);
+ double x_var = (std::exp(sqr(d.s())) - 1) * std::exp(2*d.m() + sqr(d.s()));
+ double x_skew = (std::exp(sqr(d.s())) + 2) *
+ std::sqrt((std::exp(sqr(d.s())) - 1));
+ double x_kurtosis = std::exp(4*sqr(d.s())) + 2*std::exp(3*sqr(d.s())) +
+ 3*std::exp(2*sqr(d.s())) - 6;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
+ }
+ {
+ typedef std::lognormal_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(-1./8, 0.5);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(v > 0);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = std::exp(d.m() + sqr(d.s())/2);
+ double x_var = (std::exp(sqr(d.s())) - 1) * std::exp(2*d.m() + sqr(d.s()));
+ double x_skew = (std::exp(sqr(d.s())) + 2) *
+ std::sqrt((std::exp(sqr(d.s())) - 1));
+ double x_kurtosis = std::exp(4*sqr(d.s())) + 2*std::exp(3*sqr(d.s())) +
+ 3*std::exp(2*sqr(d.s())) - 6;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.02);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.05);
+ }
+ {
+ typedef std::lognormal_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d;
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(v > 0);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = std::exp(d.m() + sqr(d.s())/2);
+ double x_var = (std::exp(sqr(d.s())) - 1) * std::exp(2*d.m() + sqr(d.s()));
+ double x_skew = (std::exp(sqr(d.s())) + 2) *
+ std::sqrt((std::exp(sqr(d.s())) - 1));
+ double x_kurtosis = std::exp(4*sqr(d.s())) + 2*std::exp(3*sqr(d.s())) +
+ 3*std::exp(2*sqr(d.s())) - 6;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.02);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.08);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.4);
+ }
+ {
+ typedef std::lognormal_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(-0.78125, 1.25);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(v > 0);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = std::exp(d.m() + sqr(d.s())/2);
+ double x_var = (std::exp(sqr(d.s())) - 1) * std::exp(2*d.m() + sqr(d.s()));
+ double x_skew = (std::exp(sqr(d.s())) + 2) *
+ std::sqrt((std::exp(sqr(d.s())) - 1));
+ double x_kurtosis = std::exp(4*sqr(d.s())) + 2*std::exp(3*sqr(d.s())) +
+ 3*std::exp(2*sqr(d.s())) - 6;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.04);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.2);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.7);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval_param.pass.cpp
new file mode 100644
index 000000000000..283403ea1a0d
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval_param.pass.cpp
@@ -0,0 +1,250 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class RealType = double>
+// class lognormal_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
+
+#include <random>
+#include <cassert>
+#include <vector>
+#include <numeric>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x * x;
+}
+
+int main()
+{
+
+ {
+ typedef std::lognormal_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d;
+ P p(-1./8192, 0.015625);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ assert(v > 0);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = std::exp(p.m() + sqr(p.s())/2);
+ double x_var = (std::exp(sqr(p.s())) - 1) * std::exp(2*p.m() + sqr(p.s()));
+ double x_skew = (std::exp(sqr(p.s())) + 2) *
+ std::sqrt((std::exp(sqr(p.s())) - 1));
+ double x_kurtosis = std::exp(4*sqr(p.s())) + 2*std::exp(3*sqr(p.s())) +
+ 3*std::exp(2*sqr(p.s())) - 6;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.05);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.25);
+ }
+ {
+ typedef std::lognormal_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d;
+ P p(-1./32, 0.25);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ assert(v > 0);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = std::exp(p.m() + sqr(p.s())/2);
+ double x_var = (std::exp(sqr(p.s())) - 1) * std::exp(2*p.m() + sqr(p.s()));
+ double x_skew = (std::exp(sqr(p.s())) + 2) *
+ std::sqrt((std::exp(sqr(p.s())) - 1));
+ double x_kurtosis = std::exp(4*sqr(p.s())) + 2*std::exp(3*sqr(p.s())) +
+ 3*std::exp(2*sqr(p.s())) - 6;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
+ }
+ {
+ typedef std::lognormal_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d;
+ P p(-1./8, 0.5);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ assert(v > 0);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = std::exp(p.m() + sqr(p.s())/2);
+ double x_var = (std::exp(sqr(p.s())) - 1) * std::exp(2*p.m() + sqr(p.s()));
+ double x_skew = (std::exp(sqr(p.s())) + 2) *
+ std::sqrt((std::exp(sqr(p.s())) - 1));
+ double x_kurtosis = std::exp(4*sqr(p.s())) + 2*std::exp(3*sqr(p.s())) +
+ 3*std::exp(2*sqr(p.s())) - 6;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.02);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.05);
+ }
+ {
+ typedef std::lognormal_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(3, 4);
+ P p;
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ assert(v > 0);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = std::exp(p.m() + sqr(p.s())/2);
+ double x_var = (std::exp(sqr(p.s())) - 1) * std::exp(2*p.m() + sqr(p.s()));
+ double x_skew = (std::exp(sqr(p.s())) + 2) *
+ std::sqrt((std::exp(sqr(p.s())) - 1));
+ double x_kurtosis = std::exp(4*sqr(p.s())) + 2*std::exp(3*sqr(p.s())) +
+ 3*std::exp(2*sqr(p.s())) - 6;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.02);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.08);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.4);
+ }
+ {
+ typedef std::lognormal_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d;
+ P p(-0.78125, 1.25);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ assert(v > 0);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = std::exp(p.m() + sqr(p.s())/2);
+ double x_var = (std::exp(sqr(p.s())) - 1) * std::exp(2*p.m() + sqr(p.s()));
+ double x_skew = (std::exp(sqr(p.s())) + 2) *
+ std::sqrt((std::exp(sqr(p.s())) - 1));
+ double x_kurtosis = std::exp(4*sqr(p.s())) + 2*std::exp(3*sqr(p.s())) +
+ 3*std::exp(2*sqr(p.s())) - 6;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.04);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.2);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.7);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/get_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/get_param.pass.cpp
new file mode 100644
index 000000000000..348ca6cfd7e6
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/get_param.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class lognormal_distribution
+
+// param_type param() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::lognormal_distribution<> D;
+ typedef D::param_type P;
+ P p(.125, .5);
+ D d(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/io.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/io.pass.cpp
new file mode 100644
index 000000000000..4af0f2eafed8
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/io.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class lognormal_distribution
+
+// template <class CharT, class Traits, class RealType>
+// basic_ostream<CharT, Traits>&
+// operator<<(basic_ostream<CharT, Traits>& os,
+// const lognormal_distribution<RealType>& x);
+
+// template <class CharT, class Traits, class RealType>
+// basic_istream<CharT, Traits>&
+// operator>>(basic_istream<CharT, Traits>& is,
+// lognormal_distribution<RealType>& x);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::lognormal_distribution<> D;
+ D d1(7, 5);
+ std::ostringstream os;
+ os << d1;
+ std::istringstream is(os.str());
+ D d2;
+ is >> d2;
+ assert(d1 == d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/max.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/max.pass.cpp
new file mode 100644
index 000000000000..7ebfc43a3217
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/max.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class lognormal_distribution
+
+// result_type max() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::lognormal_distribution<> D;
+ D d(5, .25);
+ D::result_type m = d.max();
+ assert(m == INFINITY);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/min.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/min.pass.cpp
new file mode 100644
index 000000000000..6af4df777ec3
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/min.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class lognormal_distribution
+
+// result_type min() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::lognormal_distribution<> D;
+ D d(.5, .5);
+ assert(d.min() == 0);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/param_assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/param_assign.pass.cpp
new file mode 100644
index 000000000000..b23c770f5aae
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/param_assign.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class lognormal_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::lognormal_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p0(.75, 6);
+ param_type p;
+ p = p0;
+ assert(p.m() == .75);
+ assert(p.s() == 6);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/param_copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/param_copy.pass.cpp
new file mode 100644
index 000000000000..32ecc68da3c8
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/param_copy.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class lognormal_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::lognormal_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p0(10, .125);
+ param_type p = p0;
+ assert(p.m() == 10);
+ assert(p.s() == .125);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/param_ctor.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/param_ctor.pass.cpp
new file mode 100644
index 000000000000..2f109e3f57af
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/param_ctor.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class lognormal_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::lognormal_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p;
+ assert(p.m() == 0);
+ assert(p.s() == 1);
+ }
+ {
+ typedef std::lognormal_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p(10);
+ assert(p.m() == 10);
+ assert(p.s() == 1);
+ }
+ {
+ typedef std::lognormal_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p(10, 5);
+ assert(p.m() == 10);
+ assert(p.s() == 5);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/param_eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/param_eq.pass.cpp
new file mode 100644
index 000000000000..2f4293a737d6
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/param_eq.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class lognormal_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::lognormal_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p1(0.75, .5);
+ param_type p2(0.75, .5);
+ assert(p1 == p2);
+ }
+ {
+ typedef std::lognormal_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p1(0.75, .5);
+ param_type p2(0.5, .5);
+ assert(p1 != p2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/param_types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/param_types.pass.cpp
new file mode 100644
index 000000000000..6e53b269ee8a
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/param_types.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class lognormal_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::lognormal_distribution<> D;
+ typedef D::param_type param_type;
+ typedef param_type::distribution_type distribution_type;
+ static_assert((std::is_same<D, distribution_type>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/set_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/set_param.pass.cpp
new file mode 100644
index 000000000000..09c183f51048
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/set_param.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class lognormal_distribution;
+
+// void param(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::lognormal_distribution<> D;
+ typedef D::param_type P;
+ P p(0.25, 5.5);
+ D d(0.75, 4);
+ d.param(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/types.pass.cpp
new file mode 100644
index 000000000000..1a07000d5197
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/types.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class lognormal_distribution
+// {
+// public:
+// // types
+// typedef RealType result_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::lognormal_distribution<> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, double>::value), "");
+ }
+ {
+ typedef std::lognormal_distribution<float> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, float>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/assign.pass.cpp
new file mode 100644
index 000000000000..a7b2f71abb17
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/assign.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class normal_distribution
+
+// normal_distribution& operator=(const normal_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::normal_distribution<> D;
+ D d1(20, 0.75);
+ D d2;
+ assert(d1 != d2);
+ d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/copy.pass.cpp
new file mode 100644
index 000000000000..63f5be3c1c3a
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/copy.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class normal_distribution
+
+// normal_distribution(const normal_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::normal_distribution<> D;
+ D d1(20, 1.75);
+ D d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/ctor_double_double.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/ctor_double_double.pass.cpp
new file mode 100644
index 000000000000..24a45f757ee6
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/ctor_double_double.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class normal_distribution
+
+// explicit normal_distribution(result_type mean = 0, result_type stddev = 1);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::normal_distribution<> D;
+ D d;
+ assert(d.mean() == 0);
+ assert(d.stddev() == 1);
+ }
+ {
+ typedef std::normal_distribution<> D;
+ D d(14.5);
+ assert(d.mean() == 14.5);
+ assert(d.stddev() == 1);
+ }
+ {
+ typedef std::normal_distribution<> D;
+ D d(14.5, 5.25);
+ assert(d.mean() == 14.5);
+ assert(d.stddev() == 5.25);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/ctor_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/ctor_param.pass.cpp
new file mode 100644
index 000000000000..11c7fbd6e89e
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/ctor_param.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class normal_distribution
+
+// explicit normal_distribution(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::normal_distribution<> D;
+ typedef D::param_type P;
+ P p(0.25, 10);
+ D d(p);
+ assert(d.mean() == 0.25);
+ assert(d.stddev() == 10);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eq.pass.cpp
new file mode 100644
index 000000000000..b6bd3d3166f1
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eq.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class normal_distribution
+
+// bool operator=(const normal_distribution& x,
+// const normal_distribution& y);
+// bool operator!(const normal_distribution& x,
+// const normal_distribution& y);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::normal_distribution<> D;
+ D d1(2.5, 4);
+ D d2(2.5, 4);
+ assert(d1 == d2);
+ }
+ {
+ typedef std::normal_distribution<> D;
+ D d1(2.5, 4);
+ D d2(2.5, 4.5);
+ assert(d1 != d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval.pass.cpp
new file mode 100644
index 000000000000..95d0272dbc32
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval.pass.cpp
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class RealType = double>
+// class normal_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g);
+
+#include <random>
+#include <cassert>
+#include <vector>
+#include <numeric>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x * x;
+}
+
+int main()
+{
+ {
+ typedef std::normal_distribution<> D;
+ typedef D::param_type P;
+ typedef std::minstd_rand G;
+ G g;
+ D d(5, 4);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ u.push_back(d(g));
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.mean();
+ double x_var = sqr(d.stddev());
+ double x_skew = 0;
+ double x_kurtosis = 0;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs(kurtosis - x_kurtosis) < 0.01);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval_param.pass.cpp
new file mode 100644
index 000000000000..20c3a44f13e1
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval_param.pass.cpp
@@ -0,0 +1,71 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class RealType = double>
+// class normal_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
+
+#include <random>
+#include <cassert>
+#include <vector>
+#include <numeric>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x * x;
+}
+
+int main()
+{
+ {
+ typedef std::normal_distribution<> D;
+ typedef D::param_type P;
+ typedef std::minstd_rand G;
+ G g;
+ D d(5, 4);
+ P p(50, .5);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ u.push_back(d(g, p));
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = p.mean();
+ double x_var = sqr(p.stddev());
+ double x_skew = 0;
+ double x_kurtosis = 0;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs(kurtosis - x_kurtosis) < 0.01);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/get_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/get_param.pass.cpp
new file mode 100644
index 000000000000..8b5d4328c9e3
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/get_param.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class normal_distribution
+
+// param_type param() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::normal_distribution<> D;
+ typedef D::param_type P;
+ P p(.125, .5);
+ D d(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/io.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/io.pass.cpp
new file mode 100644
index 000000000000..6d79433490ad
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/io.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class normal_distribution
+
+// template <class CharT, class Traits, class RealType>
+// basic_ostream<CharT, Traits>&
+// operator<<(basic_ostream<CharT, Traits>& os,
+// const normal_distribution<RealType>& x);
+
+// template <class CharT, class Traits, class RealType>
+// basic_istream<CharT, Traits>&
+// operator>>(basic_istream<CharT, Traits>& is,
+// normal_distribution<RealType>& x);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::normal_distribution<> D;
+ D d1(7, 5);
+ std::ostringstream os;
+ os << d1;
+ std::istringstream is(os.str());
+ D d2;
+ is >> d2;
+ assert(d1 == d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/max.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/max.pass.cpp
new file mode 100644
index 000000000000..3825704f5be6
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/max.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class normal_distribution
+
+// result_type max() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::normal_distribution<> D;
+ D d(5, .25);
+ D::result_type m = d.max();
+ assert(m == INFINITY);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/min.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/min.pass.cpp
new file mode 100644
index 000000000000..9ba754d37fcb
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/min.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class normal_distribution
+
+// result_type min() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::normal_distribution<> D;
+ D d(.5, .5);
+ assert(d.min() == -INFINITY);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/param_assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/param_assign.pass.cpp
new file mode 100644
index 000000000000..2f7329b478e8
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/param_assign.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class normal_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::normal_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p0(.75, 6);
+ param_type p;
+ p = p0;
+ assert(p.mean() == .75);
+ assert(p.stddev() == 6);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/param_copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/param_copy.pass.cpp
new file mode 100644
index 000000000000..bddf0023f84e
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/param_copy.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class normal_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::normal_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p0(10, .125);
+ param_type p = p0;
+ assert(p.mean() == 10);
+ assert(p.stddev() == .125);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/param_ctor.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/param_ctor.pass.cpp
new file mode 100644
index 000000000000..a1add140c930
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/param_ctor.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class normal_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::normal_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p;
+ assert(p.mean() == 0);
+ assert(p.stddev() == 1);
+ }
+ {
+ typedef std::normal_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p(10);
+ assert(p.mean() == 10);
+ assert(p.stddev() == 1);
+ }
+ {
+ typedef std::normal_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p(10, 5);
+ assert(p.mean() == 10);
+ assert(p.stddev() == 5);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/param_eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/param_eq.pass.cpp
new file mode 100644
index 000000000000..cf2093808804
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/param_eq.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class normal_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::normal_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p1(0.75, .5);
+ param_type p2(0.75, .5);
+ assert(p1 == p2);
+ }
+ {
+ typedef std::normal_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p1(0.75, .5);
+ param_type p2(0.5, .5);
+ assert(p1 != p2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/param_types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/param_types.pass.cpp
new file mode 100644
index 000000000000..8d9b97e74fc3
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/param_types.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class normal_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::normal_distribution<> D;
+ typedef D::param_type param_type;
+ typedef param_type::distribution_type distribution_type;
+ static_assert((std::is_same<D, distribution_type>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/set_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/set_param.pass.cpp
new file mode 100644
index 000000000000..bb01bb1c009e
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/set_param.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class normal_distribution;
+
+// void param(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::normal_distribution<> D;
+ typedef D::param_type P;
+ P p(0.25, 5.5);
+ D d(0.75, 4);
+ d.param(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/types.pass.cpp
new file mode 100644
index 000000000000..771685a8c352
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/types.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class normal_distribution
+// {
+// public:
+// // types
+// typedef RealType result_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::normal_distribution<> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, double>::value), "");
+ }
+ {
+ typedef std::normal_distribution<float> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, float>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/assign.pass.cpp
new file mode 100644
index 000000000000..80c0a19783b5
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/assign.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class student_t_distribution
+
+// student_t_distribution& operator=(const student_t_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::student_t_distribution<> D;
+ D d1(20.75);
+ D d2;
+ assert(d1 != d2);
+ d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/copy.pass.cpp
new file mode 100644
index 000000000000..032cf77e8645
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/copy.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class student_t_distribution
+
+// student_t_distribution(const student_t_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::student_t_distribution<> D;
+ D d1(21.75);
+ D d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/ctor_double.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/ctor_double.pass.cpp
new file mode 100644
index 000000000000..7dfb97fb09c1
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/ctor_double.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class student_t_distribution
+
+// explicit student_t_distribution(result_type alpha = 0, result_type beta = 1);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::student_t_distribution<> D;
+ D d;
+ assert(d.n() == 1);
+ }
+ {
+ typedef std::student_t_distribution<> D;
+ D d(14.5);
+ assert(d.n() == 14.5);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/ctor_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/ctor_param.pass.cpp
new file mode 100644
index 000000000000..57dedea87ed8
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/ctor_param.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class student_t_distribution
+
+// explicit student_t_distribution(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::student_t_distribution<> D;
+ typedef D::param_type P;
+ P p(0.25);
+ D d(p);
+ assert(d.n() == 0.25);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eq.pass.cpp
new file mode 100644
index 000000000000..73e8340439ce
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eq.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class student_t_distribution
+
+// bool operator=(const student_t_distribution& x,
+// const student_t_distribution& y);
+// bool operator!(const student_t_distribution& x,
+// const student_t_distribution& y);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::student_t_distribution<> D;
+ D d1(2.5);
+ D d2(2.5);
+ assert(d1 == d2);
+ }
+ {
+ typedef std::student_t_distribution<> D;
+ D d1(4);
+ D d2(4.5);
+ assert(d1 != d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval.pass.cpp
new file mode 100644
index 000000000000..ef6b37e9f9cc
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval.pass.cpp
@@ -0,0 +1,142 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class RealType = double>
+// class student_t_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g);
+
+#include <random>
+#include <cassert>
+#include <vector>
+#include <numeric>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x * x;
+}
+
+int main()
+{
+ {
+ typedef std::student_t_distribution<> D;
+ typedef D::param_type P;
+ typedef std::minstd_rand G;
+ G g;
+ D d(5.5);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ u.push_back(d(g));
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = 0;
+ double x_var = d.n() / (d.n() - 2);
+ double x_skew = 0;
+ double x_kurtosis = 6 / (d.n() - 4);
+ assert(std::abs(mean - x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.2);
+ }
+ {
+ typedef std::student_t_distribution<> D;
+ typedef D::param_type P;
+ typedef std::minstd_rand G;
+ G g;
+ D d(10);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ u.push_back(d(g));
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = 0;
+ double x_var = d.n() / (d.n() - 2);
+ double x_skew = 0;
+ double x_kurtosis = 6 / (d.n() - 4);
+ assert(std::abs(mean - x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.04);
+ }
+ {
+ typedef std::student_t_distribution<> D;
+ typedef D::param_type P;
+ typedef std::minstd_rand G;
+ G g;
+ D d(100);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ u.push_back(d(g));
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = 0;
+ double x_var = d.n() / (d.n() - 2);
+ double x_skew = 0;
+ double x_kurtosis = 6 / (d.n() - 4);
+ assert(std::abs(mean - x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval_param.pass.cpp
new file mode 100644
index 000000000000..70bc29e3ad13
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval_param.pass.cpp
@@ -0,0 +1,145 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class RealType = double>
+// class student_t_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
+
+#include <random>
+#include <cassert>
+#include <vector>
+#include <numeric>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x * x;
+}
+
+int main()
+{
+ {
+ typedef std::student_t_distribution<> D;
+ typedef D::param_type P;
+ typedef std::minstd_rand G;
+ G g;
+ D d;
+ P p(5.5);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ u.push_back(d(g, p));
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = 0;
+ double x_var = p.n() / (p.n() - 2);
+ double x_skew = 0;
+ double x_kurtosis = 6 / (p.n() - 4);
+ assert(std::abs(mean - x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.2);
+ }
+ {
+ typedef std::student_t_distribution<> D;
+ typedef D::param_type P;
+ typedef std::minstd_rand G;
+ G g;
+ D d;
+ P p(10);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ u.push_back(d(g, p));
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = 0;
+ double x_var = p.n() / (p.n() - 2);
+ double x_skew = 0;
+ double x_kurtosis = 6 / (p.n() - 4);
+ assert(std::abs(mean - x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.04);
+ }
+ {
+ typedef std::student_t_distribution<> D;
+ typedef D::param_type P;
+ typedef std::minstd_rand G;
+ G g;
+ D d;
+ P p(100);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ u.push_back(d(g, p));
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = 0;
+ double x_var = p.n() / (p.n() - 2);
+ double x_skew = 0;
+ double x_kurtosis = 6 / (p.n() - 4);
+ assert(std::abs(mean - x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/get_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/get_param.pass.cpp
new file mode 100644
index 000000000000..a702a9fc5a01
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/get_param.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class student_t_distribution
+
+// param_type param() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::student_t_distribution<> D;
+ typedef D::param_type P;
+ P p(.125);
+ D d(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/io.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/io.pass.cpp
new file mode 100644
index 000000000000..d3ca6ee28c73
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/io.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class student_t_distribution
+
+// template <class CharT, class Traits, class RealType>
+// basic_ostream<CharT, Traits>&
+// operator<<(basic_ostream<CharT, Traits>& os,
+// const student_t_distribution<RealType>& x);
+
+// template <class CharT, class Traits, class RealType>
+// basic_istream<CharT, Traits>&
+// operator>>(basic_istream<CharT, Traits>& is,
+// student_t_distribution<RealType>& x);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::student_t_distribution<> D;
+ D d1(7);
+ std::ostringstream os;
+ os << d1;
+ std::istringstream is(os.str());
+ D d2;
+ is >> d2;
+ assert(d1 == d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/max.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/max.pass.cpp
new file mode 100644
index 000000000000..aab361eaa3c3
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/max.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class student_t_distribution
+
+// result_type max() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::student_t_distribution<> D;
+ D d(5);
+ D::result_type m = d.max();
+ assert(m == INFINITY);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/min.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/min.pass.cpp
new file mode 100644
index 000000000000..a615f8efea90
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/min.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class student_t_distribution
+
+// result_type min() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::student_t_distribution<> D;
+ D d(.5);
+ assert(d.min() == -INFINITY);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/param_assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/param_assign.pass.cpp
new file mode 100644
index 000000000000..e900c2566777
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/param_assign.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class student_t_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::student_t_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p0(.75);
+ param_type p;
+ p = p0;
+ assert(p.n() == .75);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/param_copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/param_copy.pass.cpp
new file mode 100644
index 000000000000..9ce6a916275c
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/param_copy.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class student_t_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::student_t_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p0(10);
+ param_type p = p0;
+ assert(p.n() == 10);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/param_ctor.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/param_ctor.pass.cpp
new file mode 100644
index 000000000000..c9d0e131da0b
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/param_ctor.pass.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class student_t_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::student_t_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p;
+ assert(p.n() == 1);
+ }
+ {
+ typedef std::student_t_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p(10);
+ assert(p.n() == 10);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/param_eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/param_eq.pass.cpp
new file mode 100644
index 000000000000..83634b2e3e93
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/param_eq.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class student_t_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::student_t_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p1(0.75);
+ param_type p2(0.75);
+ assert(p1 == p2);
+ }
+ {
+ typedef std::student_t_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p1(0.75);
+ param_type p2(0.5);
+ assert(p1 != p2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/param_types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/param_types.pass.cpp
new file mode 100644
index 000000000000..6cdd5c403e8d
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/param_types.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class student_t_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::student_t_distribution<> D;
+ typedef D::param_type param_type;
+ typedef param_type::distribution_type distribution_type;
+ static_assert((std::is_same<D, distribution_type>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/set_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/set_param.pass.cpp
new file mode 100644
index 000000000000..681d335a537f
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/set_param.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class student_t_distribution;
+
+// void param(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::student_t_distribution<> D;
+ typedef D::param_type P;
+ P p(0.25);
+ D d(0.75);
+ d.param(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/types.pass.cpp
new file mode 100644
index 000000000000..9a25ce2d6181
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/types.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class student_t_distribution
+// {
+// public:
+// // types
+// typedef RealType result_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::student_t_distribution<> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, double>::value), "");
+ }
+ {
+ typedef std::student_t_distribution<float> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, float>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/nothing_to_do.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..b58f5c55b643
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/assign.pass.cpp
new file mode 100644
index 000000000000..c2a11a15b505
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/assign.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class exponential_distribution
+
+// exponential_distribution& operator=(const exponential_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::exponential_distribution<> D;
+ D d1(0.75);
+ D d2;
+ assert(d1 != d2);
+ d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/copy.pass.cpp
new file mode 100644
index 000000000000..81ae8e012614
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/copy.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class exponential_distribution
+
+// exponential_distribution(const exponential_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::exponential_distribution<> D;
+ D d1(1.75);
+ D d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/ctor_double.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/ctor_double.pass.cpp
new file mode 100644
index 000000000000..92205a8abed1
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/ctor_double.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class exponential_distribution
+
+// explicit exponential_distribution(RealType lambda = 1.0);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::exponential_distribution<> D;
+ D d;
+ assert(d.lambda() == 1);
+ }
+ {
+ typedef std::exponential_distribution<> D;
+ D d(3.5);
+ assert(d.lambda() == 3.5);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/ctor_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/ctor_param.pass.cpp
new file mode 100644
index 000000000000..cd9782bf4370
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/ctor_param.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class exponential_distribution
+
+// explicit exponential_distribution(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::exponential_distribution<> D;
+ typedef D::param_type P;
+ P p(0.25);
+ D d(p);
+ assert(d.lambda() == 0.25);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eq.pass.cpp
new file mode 100644
index 000000000000..e31a14d0d0b8
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eq.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class exponential_distribution
+
+// bool operator=(const exponential_distribution& x,
+// const exponential_distribution& y);
+// bool operator!(const exponential_distribution& x,
+// const exponential_distribution& y);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::exponential_distribution<> D;
+ D d1(.25);
+ D d2(.25);
+ assert(d1 == d2);
+ }
+ {
+ typedef std::exponential_distribution<> D;
+ D d1(.28);
+ D d2(.25);
+ assert(d1 != d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eval.pass.cpp
new file mode 100644
index 000000000000..b2fe52676e7e
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eval.pass.cpp
@@ -0,0 +1,154 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class RealType = double>
+// class exponential_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g);
+
+#include <random>
+#include <cassert>
+#include <vector>
+#include <numeric>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x * x;
+}
+
+int main()
+{
+ {
+ typedef std::exponential_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(.75);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() < v);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = 1/d.lambda();
+ double x_var = 1/sqr(d.lambda());
+ double x_skew = 2;
+ double x_kurtosis = 6;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::exponential_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(1);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() < v);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = 1/d.lambda();
+ double x_var = 1/sqr(d.lambda());
+ double x_skew = 2;
+ double x_kurtosis = 6;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::exponential_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(10);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() < v);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = 1/d.lambda();
+ double x_var = 1/sqr(d.lambda());
+ double x_skew = 2;
+ double x_kurtosis = 6;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eval_param.pass.cpp
new file mode 100644
index 000000000000..9879e63a33e9
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eval_param.pass.cpp
@@ -0,0 +1,75 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class RealType = double>
+// class exponential_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
+
+#include <random>
+#include <cassert>
+#include <vector>
+#include <numeric>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x * x;
+}
+
+int main()
+{
+ {
+ typedef std::exponential_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(.75);
+ P p(2);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ assert(d.min() < v);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = 1/p.lambda();
+ double x_var = 1/sqr(p.lambda());
+ double x_skew = 2;
+ double x_kurtosis = 6;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/get_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/get_param.pass.cpp
new file mode 100644
index 000000000000..f5bd8107e4b3
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/get_param.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class exponential_distribution
+
+// param_type param() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::exponential_distribution<> D;
+ typedef D::param_type P;
+ P p(.125);
+ D d(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/io.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/io.pass.cpp
new file mode 100644
index 000000000000..eaedc8770efd
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/io.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class exponential_distribution
+
+// template <class CharT, class Traits, class RealType>
+// basic_ostream<CharT, Traits>&
+// operator<<(basic_ostream<CharT, Traits>& os,
+// const exponential_distribution<RealType>& x);
+
+// template <class CharT, class Traits, class RealType>
+// basic_istream<CharT, Traits>&
+// operator>>(basic_istream<CharT, Traits>& is,
+// exponential_distribution<RealType>& x);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::exponential_distribution<> D;
+ D d1(7);
+ std::ostringstream os;
+ os << d1;
+ std::istringstream is(os.str());
+ D d2;
+ is >> d2;
+ assert(d1 == d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/max.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/max.pass.cpp
new file mode 100644
index 000000000000..204cd7c0c97b
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/max.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class exponential_distribution
+
+// result_type max() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::exponential_distribution<> D;
+ D d(.25);
+ D::result_type m = d.max();
+ assert(m == std::numeric_limits<D::result_type>::infinity());
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/min.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/min.pass.cpp
new file mode 100644
index 000000000000..60af4bc81a99
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/min.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class exponential_distribution
+
+// result_type min() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::exponential_distribution<> D;
+ D d(.5);
+ assert(d.min() == 0);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/param_assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/param_assign.pass.cpp
new file mode 100644
index 000000000000..1f5352192bd1
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/param_assign.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class exponential_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::exponential_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p0(.7);
+ param_type p;
+ p = p0;
+ assert(p.lambda() == .7);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/param_copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/param_copy.pass.cpp
new file mode 100644
index 000000000000..360bd5daa60d
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/param_copy.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class exponential_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::exponential_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p0(.125);
+ param_type p = p0;
+ assert(p.lambda() == .125);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/param_ctor.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/param_ctor.pass.cpp
new file mode 100644
index 000000000000..7d74c7fccd1c
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/param_ctor.pass.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class exponential_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::exponential_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p;
+ assert(p.lambda() == 1);
+ }
+ {
+ typedef std::exponential_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p(10);
+ assert(p.lambda() == 10);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/param_eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/param_eq.pass.cpp
new file mode 100644
index 000000000000..416d18cab930
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/param_eq.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class exponential_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::exponential_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p1(0.75);
+ param_type p2(0.75);
+ assert(p1 == p2);
+ }
+ {
+ typedef std::exponential_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p1(0.75);
+ param_type p2(0.5);
+ assert(p1 != p2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/param_types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/param_types.pass.cpp
new file mode 100644
index 000000000000..3d7371165e5b
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/param_types.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class exponential_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::exponential_distribution<> D;
+ typedef D::param_type param_type;
+ typedef param_type::distribution_type distribution_type;
+ static_assert((std::is_same<D, distribution_type>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/set_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/set_param.pass.cpp
new file mode 100644
index 000000000000..6c295aa1b07e
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/set_param.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class exponential_distribution;
+
+// void param(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::exponential_distribution<> D;
+ typedef D::param_type P;
+ P p(0.25);
+ D d(0.75);
+ d.param(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/types.pass.cpp
new file mode 100644
index 000000000000..3d444e631db9
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/types.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class exponential_distribution
+// {
+// public:
+// // types
+// typedef RealType result_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::exponential_distribution<> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, double>::value), "");
+ }
+ {
+ typedef std::exponential_distribution<float> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, float>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/assign.pass.cpp
new file mode 100644
index 000000000000..ff7cff45e994
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/assign.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class extreme_value_distribution
+
+// extreme_value_distribution& operator=(const extreme_value_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::extreme_value_distribution<> D;
+ D d1(.5, 2);
+ D d2;
+ assert(d1 != d2);
+ d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/copy.pass.cpp
new file mode 100644
index 000000000000..303779768c21
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/copy.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class extreme_value_distribution
+
+// extreme_value_distribution(const extreme_value_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::extreme_value_distribution<> D;
+ D d1(.5, 1.75);
+ D d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/ctor_double_double.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/ctor_double_double.pass.cpp
new file mode 100644
index 000000000000..f5068d98dc68
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/ctor_double_double.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class extreme_value_distribution
+
+// explicit extreme_value_distribution(result_type a = 0, result_type b = 1);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::extreme_value_distribution<> D;
+ D d;
+ assert(d.a() == 0);
+ assert(d.b() == 1);
+ }
+ {
+ typedef std::extreme_value_distribution<> D;
+ D d(14.5);
+ assert(d.a() == 14.5);
+ assert(d.b() == 1);
+ }
+ {
+ typedef std::extreme_value_distribution<> D;
+ D d(14.5, 5.25);
+ assert(d.a() == 14.5);
+ assert(d.b() == 5.25);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/ctor_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/ctor_param.pass.cpp
new file mode 100644
index 000000000000..cac06699e417
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/ctor_param.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class extreme_value_distribution
+
+// explicit extreme_value_distribution(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::extreme_value_distribution<> D;
+ typedef D::param_type P;
+ P p(0.25, 10);
+ D d(p);
+ assert(d.a() == 0.25);
+ assert(d.b() == 10);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eq.pass.cpp
new file mode 100644
index 000000000000..6280df4f54a3
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eq.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class extreme_value_distribution
+
+// bool operator=(const extreme_value_distribution& x,
+// const extreme_value_distribution& y);
+// bool operator!(const extreme_value_distribution& x,
+// const extreme_value_distribution& y);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::extreme_value_distribution<> D;
+ D d1(2.5, 4);
+ D d2(2.5, 4);
+ assert(d1 == d2);
+ }
+ {
+ typedef std::extreme_value_distribution<> D;
+ D d1(2.5, 4);
+ D d2(2.5, 4.5);
+ assert(d1 != d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval.pass.cpp
new file mode 100644
index 000000000000..6390acef8941
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval.pass.cpp
@@ -0,0 +1,190 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class RealType = double>
+// class extreme_value_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g);
+
+#include <random>
+#include <cassert>
+#include <vector>
+#include <numeric>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x * x;
+}
+
+int main()
+{
+ {
+ typedef std::extreme_value_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(0.5, 2);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.a() + d.b() * 0.577215665;
+ double x_var = sqr(d.b()) * 1.644934067;
+ double x_skew = 1.139547;
+ double x_kurtosis = 12./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::extreme_value_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(1, 2);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.a() + d.b() * 0.577215665;
+ double x_var = sqr(d.b()) * 1.644934067;
+ double x_skew = 1.139547;
+ double x_kurtosis = 12./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::extreme_value_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(1.5, 3);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.a() + d.b() * 0.577215665;
+ double x_var = sqr(d.b()) * 1.644934067;
+ double x_skew = 1.139547;
+ double x_kurtosis = 12./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::extreme_value_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(3, 4);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.a() + d.b() * 0.577215665;
+ double x_var = sqr(d.b()) * 1.644934067;
+ double x_skew = 1.139547;
+ double x_kurtosis = 12./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval_param.pass.cpp
new file mode 100644
index 000000000000..6152cce8f4f8
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval_param.pass.cpp
@@ -0,0 +1,194 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class RealType = double>
+// class extreme_value_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
+
+#include <random>
+#include <cassert>
+#include <vector>
+#include <numeric>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x * x;
+}
+
+int main()
+{
+ {
+ typedef std::extreme_value_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(-0.5, 1);
+ P p(0.5, 2);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = p.a() + p.b() * 0.577215665;
+ double x_var = sqr(p.b()) * 1.644934067;
+ double x_skew = 1.139547;
+ double x_kurtosis = 12./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::extreme_value_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(-0.5, 1);
+ P p(1, 2);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = p.a() + p.b() * 0.577215665;
+ double x_var = sqr(p.b()) * 1.644934067;
+ double x_skew = 1.139547;
+ double x_kurtosis = 12./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::extreme_value_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(-0.5, 1);
+ P p(1.5, 3);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = p.a() + p.b() * 0.577215665;
+ double x_var = sqr(p.b()) * 1.644934067;
+ double x_skew = 1.139547;
+ double x_kurtosis = 12./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::extreme_value_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(-0.5, 1);
+ P p(3, 4);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = p.a() + p.b() * 0.577215665;
+ double x_var = sqr(p.b()) * 1.644934067;
+ double x_skew = 1.139547;
+ double x_kurtosis = 12./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/get_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/get_param.pass.cpp
new file mode 100644
index 000000000000..1855d5f73b2b
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/get_param.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class extreme_value_distribution
+
+// param_type param() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::extreme_value_distribution<> D;
+ typedef D::param_type P;
+ P p(.125, .5);
+ D d(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/io.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/io.pass.cpp
new file mode 100644
index 000000000000..0beaf429301b
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/io.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class extreme_value_distribution
+
+// template <class CharT, class Traits, class RealType>
+// basic_ostream<CharT, Traits>&
+// operator<<(basic_ostream<CharT, Traits>& os,
+// const extreme_value_distribution<RealType>& x);
+
+// template <class CharT, class Traits, class RealType>
+// basic_istream<CharT, Traits>&
+// operator>>(basic_istream<CharT, Traits>& is,
+// extreme_value_distribution<RealType>& x);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::extreme_value_distribution<> D;
+ D d1(7.5, 5.5);
+ std::ostringstream os;
+ os << d1;
+ std::istringstream is(os.str());
+ D d2;
+ is >> d2;
+ assert(d1 == d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/max.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/max.pass.cpp
new file mode 100644
index 000000000000..ca89e355b2fe
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/max.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class extreme_value_distribution
+
+// result_type max() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::extreme_value_distribution<> D;
+ D d(5, .25);
+ D::result_type m = d.max();
+ assert(m == INFINITY);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/min.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/min.pass.cpp
new file mode 100644
index 000000000000..1f98a5b17390
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/min.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class extreme_value_distribution
+
+// result_type min() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::extreme_value_distribution<> D;
+ D d(.5, .5);
+ assert(d.min() == -INFINITY);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/param_assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/param_assign.pass.cpp
new file mode 100644
index 000000000000..44f587f625b5
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/param_assign.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class extreme_value_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::extreme_value_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p0(.75, 6);
+ param_type p;
+ p = p0;
+ assert(p.a() == .75);
+ assert(p.b() == 6);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/param_copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/param_copy.pass.cpp
new file mode 100644
index 000000000000..6675bab61589
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/param_copy.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class extreme_value_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::extreme_value_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p0(10, .125);
+ param_type p = p0;
+ assert(p.a() == 10);
+ assert(p.b() == .125);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/param_ctor.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/param_ctor.pass.cpp
new file mode 100644
index 000000000000..3fe3d49c334d
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/param_ctor.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class extreme_value_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::extreme_value_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p;
+ assert(p.a() == 0);
+ assert(p.b() == 1);
+ }
+ {
+ typedef std::extreme_value_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p(10);
+ assert(p.a() == 10);
+ assert(p.b() == 1);
+ }
+ {
+ typedef std::extreme_value_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p(10, 5);
+ assert(p.a() == 10);
+ assert(p.b() == 5);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/param_eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/param_eq.pass.cpp
new file mode 100644
index 000000000000..3b55d569f5f4
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/param_eq.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class extreme_value_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::extreme_value_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p1(0.75, .5);
+ param_type p2(0.75, .5);
+ assert(p1 == p2);
+ }
+ {
+ typedef std::extreme_value_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p1(0.75, .5);
+ param_type p2(0.5, .5);
+ assert(p1 != p2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/param_types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/param_types.pass.cpp
new file mode 100644
index 000000000000..d6ffb5f0c10d
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/param_types.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class extreme_value_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::extreme_value_distribution<> D;
+ typedef D::param_type param_type;
+ typedef param_type::distribution_type distribution_type;
+ static_assert((std::is_same<D, distribution_type>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/set_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/set_param.pass.cpp
new file mode 100644
index 000000000000..dcf0b1659bea
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/set_param.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class extreme_value_distribution;
+
+// void param(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::extreme_value_distribution<> D;
+ typedef D::param_type P;
+ P p(0.25, 5.5);
+ D d(0.75, 4);
+ d.param(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/types.pass.cpp
new file mode 100644
index 000000000000..44dd1816c1a6
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/types.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class extreme_value_distribution
+// {
+// public:
+// // types
+// typedef RealType result_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::extreme_value_distribution<> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, double>::value), "");
+ }
+ {
+ typedef std::extreme_value_distribution<float> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, float>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/assign.pass.cpp
new file mode 100644
index 000000000000..671f4b1cde44
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/assign.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class gamma_distribution
+
+// gamma_distribution& operator=(const gamma_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::gamma_distribution<> D;
+ D d1(20, 0.75);
+ D d2;
+ assert(d1 != d2);
+ d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/copy.pass.cpp
new file mode 100644
index 000000000000..876ecb27f8b1
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/copy.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class gamma_distribution
+
+// gamma_distribution(const gamma_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::gamma_distribution<> D;
+ D d1(20, 1.75);
+ D d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/ctor_double_double.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/ctor_double_double.pass.cpp
new file mode 100644
index 000000000000..5bc4bbaea893
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/ctor_double_double.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class gamma_distribution
+
+// explicit gamma_distribution(result_type alpha = 0, result_type beta = 1);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::gamma_distribution<> D;
+ D d;
+ assert(d.alpha() == 1);
+ assert(d.beta() == 1);
+ }
+ {
+ typedef std::gamma_distribution<> D;
+ D d(14.5);
+ assert(d.alpha() == 14.5);
+ assert(d.beta() == 1);
+ }
+ {
+ typedef std::gamma_distribution<> D;
+ D d(14.5, 5.25);
+ assert(d.alpha() == 14.5);
+ assert(d.beta() == 5.25);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/ctor_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/ctor_param.pass.cpp
new file mode 100644
index 000000000000..35de51b1c4b0
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/ctor_param.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class gamma_distribution
+
+// explicit gamma_distribution(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::gamma_distribution<> D;
+ typedef D::param_type P;
+ P p(0.25, 10);
+ D d(p);
+ assert(d.alpha() == 0.25);
+ assert(d.beta() == 10);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eq.pass.cpp
new file mode 100644
index 000000000000..48331a609ce4
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eq.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class gamma_distribution
+
+// bool operator=(const gamma_distribution& x,
+// const gamma_distribution& y);
+// bool operator!(const gamma_distribution& x,
+// const gamma_distribution& y);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::gamma_distribution<> D;
+ D d1(2.5, 4);
+ D d2(2.5, 4);
+ assert(d1 == d2);
+ }
+ {
+ typedef std::gamma_distribution<> D;
+ D d1(2.5, 4);
+ D d2(2.5, 4.5);
+ assert(d1 != d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval.pass.cpp
new file mode 100644
index 000000000000..7c26cc8a1c47
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval.pass.cpp
@@ -0,0 +1,154 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class RealType = double>
+// class gamma_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g);
+
+#include <random>
+#include <cassert>
+#include <vector>
+#include <numeric>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x * x;
+}
+
+int main()
+{
+ {
+ typedef std::gamma_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(0.5, 2);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() < v);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.alpha() * d.beta();
+ double x_var = d.alpha() * sqr(d.beta());
+ double x_skew = 2 / std::sqrt(d.alpha());
+ double x_kurtosis = 6 / d.alpha();
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::gamma_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(1, .5);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() < v);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.alpha() * d.beta();
+ double x_var = d.alpha() * sqr(d.beta());
+ double x_skew = 2 / std::sqrt(d.alpha());
+ double x_kurtosis = 6 / d.alpha();
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::gamma_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(2, 3);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() < v);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.alpha() * d.beta();
+ double x_var = d.alpha() * sqr(d.beta());
+ double x_skew = 2 / std::sqrt(d.alpha());
+ double x_kurtosis = 6 / d.alpha();
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval_param.pass.cpp
new file mode 100644
index 000000000000..8ed39df819d7
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval_param.pass.cpp
@@ -0,0 +1,157 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class RealType = double>
+// class gamma_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
+
+#include <random>
+#include <cassert>
+#include <vector>
+#include <numeric>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x * x;
+}
+
+int main()
+{
+ {
+ typedef std::gamma_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(0.5, 2);
+ P p(1, .5);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ assert(d.min() < v);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = p.alpha() * p.beta();
+ double x_var = p.alpha() * sqr(p.beta());
+ double x_skew = 2 / std::sqrt(p.alpha());
+ double x_kurtosis = 6 / p.alpha();
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::gamma_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(1, .5);
+ P p(2, 3);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ assert(d.min() < v);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = p.alpha() * p.beta();
+ double x_var = p.alpha() * sqr(p.beta());
+ double x_skew = 2 / std::sqrt(p.alpha());
+ double x_kurtosis = 6 / p.alpha();
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::gamma_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(2, 3);
+ P p(.5, 2);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ assert(d.min() < v);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = p.alpha() * p.beta();
+ double x_var = p.alpha() * sqr(p.beta());
+ double x_skew = 2 / std::sqrt(p.alpha());
+ double x_kurtosis = 6 / p.alpha();
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/get_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/get_param.pass.cpp
new file mode 100644
index 000000000000..0aad32c64697
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/get_param.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class gamma_distribution
+
+// param_type param() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::gamma_distribution<> D;
+ typedef D::param_type P;
+ P p(.125, .5);
+ D d(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/io.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/io.pass.cpp
new file mode 100644
index 000000000000..a2a288adf595
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/io.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class gamma_distribution
+
+// template <class CharT, class Traits, class RealType>
+// basic_ostream<CharT, Traits>&
+// operator<<(basic_ostream<CharT, Traits>& os,
+// const gamma_distribution<RealType>& x);
+
+// template <class CharT, class Traits, class RealType>
+// basic_istream<CharT, Traits>&
+// operator>>(basic_istream<CharT, Traits>& is,
+// gamma_distribution<RealType>& x);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::gamma_distribution<> D;
+ D d1(7, 5);
+ std::ostringstream os;
+ os << d1;
+ std::istringstream is(os.str());
+ D d2;
+ is >> d2;
+ assert(d1 == d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/max.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/max.pass.cpp
new file mode 100644
index 000000000000..9ec51932a5d5
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/max.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class gamma_distribution
+
+// result_type max() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::gamma_distribution<> D;
+ D d(5, .25);
+ D::result_type m = d.max();
+ assert(m == INFINITY);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/min.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/min.pass.cpp
new file mode 100644
index 000000000000..a918c147900f
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/min.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class gamma_distribution
+
+// result_type min() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::gamma_distribution<> D;
+ D d(.5, .5);
+ assert(d.min() == 0);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/param_assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/param_assign.pass.cpp
new file mode 100644
index 000000000000..31f346ed5d65
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/param_assign.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class gamma_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::gamma_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p0(.75, 6);
+ param_type p;
+ p = p0;
+ assert(p.alpha() == .75);
+ assert(p.beta() == 6);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/param_copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/param_copy.pass.cpp
new file mode 100644
index 000000000000..c96cbcd2ead7
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/param_copy.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class gamma_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::gamma_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p0(10, .125);
+ param_type p = p0;
+ assert(p.alpha() == 10);
+ assert(p.beta() == .125);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/param_ctor.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/param_ctor.pass.cpp
new file mode 100644
index 000000000000..c0e34f0b56e9
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/param_ctor.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class gamma_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::gamma_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p;
+ assert(p.alpha() == 1);
+ assert(p.beta() == 1);
+ }
+ {
+ typedef std::gamma_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p(10);
+ assert(p.alpha() == 10);
+ assert(p.beta() == 1);
+ }
+ {
+ typedef std::gamma_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p(10, 5);
+ assert(p.alpha() == 10);
+ assert(p.beta() == 5);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/param_eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/param_eq.pass.cpp
new file mode 100644
index 000000000000..2fe9c2d71fac
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/param_eq.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class gamma_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::gamma_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p1(0.75, .5);
+ param_type p2(0.75, .5);
+ assert(p1 == p2);
+ }
+ {
+ typedef std::gamma_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p1(0.75, .5);
+ param_type p2(0.5, .5);
+ assert(p1 != p2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/param_types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/param_types.pass.cpp
new file mode 100644
index 000000000000..51e8eb123e6c
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/param_types.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class gamma_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::gamma_distribution<> D;
+ typedef D::param_type param_type;
+ typedef param_type::distribution_type distribution_type;
+ static_assert((std::is_same<D, distribution_type>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/set_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/set_param.pass.cpp
new file mode 100644
index 000000000000..7e226299014d
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/set_param.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class gamma_distribution;
+
+// void param(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::gamma_distribution<> D;
+ typedef D::param_type P;
+ P p(0.25, 5.5);
+ D d(0.75, 4);
+ d.param(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/types.pass.cpp
new file mode 100644
index 000000000000..65459e00f3ef
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/types.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class gamma_distribution
+// {
+// public:
+// // types
+// typedef RealType result_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::gamma_distribution<> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, double>::value), "");
+ }
+ {
+ typedef std::gamma_distribution<float> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, float>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/assign.pass.cpp
new file mode 100644
index 000000000000..5f145552511c
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/assign.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class poisson_distribution
+
+// poisson_distribution& operator=(const poisson_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::poisson_distribution<> D;
+ D d1(0.75);
+ D d2;
+ assert(d1 != d2);
+ d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/copy.pass.cpp
new file mode 100644
index 000000000000..8abf7ffbd536
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/copy.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class poisson_distribution
+
+// poisson_distribution(const poisson_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::poisson_distribution<> D;
+ D d1(1.75);
+ D d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/ctor_double.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/ctor_double.pass.cpp
new file mode 100644
index 000000000000..0cc82cac5065
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/ctor_double.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class poisson_distribution
+
+// explicit poisson_distribution(RealType lambda = 1.0);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::poisson_distribution<> D;
+ D d;
+ assert(d.mean() == 1);
+ }
+ {
+ typedef std::poisson_distribution<> D;
+ D d(3.5);
+ assert(d.mean() == 3.5);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/ctor_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/ctor_param.pass.cpp
new file mode 100644
index 000000000000..a24d7550b7d7
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/ctor_param.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class poisson_distribution
+
+// explicit poisson_distribution(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::poisson_distribution<> D;
+ typedef D::param_type P;
+ P p(0.25);
+ D d(p);
+ assert(d.mean() == 0.25);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eq.pass.cpp
new file mode 100644
index 000000000000..7bea12ec6cb1
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eq.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class poisson_distribution
+
+// bool operator=(const poisson_distribution& x,
+// const poisson_distribution& y);
+// bool operator!(const poisson_distribution& x,
+// const poisson_distribution& y);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::poisson_distribution<> D;
+ D d1(.25);
+ D d2(.25);
+ assert(d1 == d2);
+ }
+ {
+ typedef std::poisson_distribution<> D;
+ D d1(.28);
+ D d2(.25);
+ assert(d1 != d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval.pass.cpp
new file mode 100644
index 000000000000..f5598978bf0a
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval.pass.cpp
@@ -0,0 +1,151 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class IntType = int>
+// class poisson_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g);
+
+#include <random>
+#include <cassert>
+#include <vector>
+#include <numeric>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x * x;
+}
+
+int main()
+{
+ {
+ typedef std::poisson_distribution<> D;
+ typedef std::minstd_rand G;
+ G g;
+ D d(2);
+ const int N = 100000;
+ std::vector<double> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.mean();
+ double x_var = d.mean();
+ double x_skew = 1 / std::sqrt(x_var);
+ double x_kurtosis = 1 / x_var;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
+ }
+ {
+ typedef std::poisson_distribution<> D;
+ typedef std::minstd_rand G;
+ G g;
+ D d(0.75);
+ const int N = 100000;
+ std::vector<double> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.mean();
+ double x_var = d.mean();
+ double x_skew = 1 / std::sqrt(x_var);
+ double x_kurtosis = 1 / x_var;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.04);
+ }
+ {
+ typedef std::poisson_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d(20);
+ const int N = 1000000;
+ std::vector<double> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.mean();
+ double x_var = d.mean();
+ double x_skew = 1 / std::sqrt(x_var);
+ double x_kurtosis = 1 / x_var;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval_param.pass.cpp
new file mode 100644
index 000000000000..c3bbdeb0ed6c
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval_param.pass.cpp
@@ -0,0 +1,157 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class IntType = int>
+// class poisson_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
+
+#include <random>
+#include <cassert>
+#include <vector>
+#include <numeric>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x * x;
+}
+
+int main()
+{
+ {
+ typedef std::poisson_distribution<> D;
+ typedef D::param_type P;
+ typedef std::minstd_rand G;
+ G g;
+ D d(.75);
+ P p(2);
+ const int N = 100000;
+ std::vector<double> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = p.mean();
+ double x_var = p.mean();
+ double x_skew = 1 / std::sqrt(x_var);
+ double x_kurtosis = 1 / x_var;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
+ }
+ {
+ typedef std::poisson_distribution<> D;
+ typedef D::param_type P;
+ typedef std::minstd_rand G;
+ G g;
+ D d(2);
+ P p(.75);
+ const int N = 100000;
+ std::vector<double> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = p.mean();
+ double x_var = p.mean();
+ double x_skew = 1 / std::sqrt(x_var);
+ double x_kurtosis = 1 / x_var;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.04);
+ }
+ {
+ typedef std::poisson_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(2);
+ P p(20);
+ const int N = 1000000;
+ std::vector<double> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ assert(d.min() <= v && v <= d.max());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = p.mean();
+ double x_var = p.mean();
+ double x_skew = 1 / std::sqrt(x_var);
+ double x_kurtosis = 1 / x_var;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/get_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/get_param.pass.cpp
new file mode 100644
index 000000000000..3f5f36769836
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/get_param.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class poisson_distribution
+
+// param_type param() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::poisson_distribution<> D;
+ typedef D::param_type P;
+ P p(.125);
+ D d(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/io.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/io.pass.cpp
new file mode 100644
index 000000000000..63805591bab4
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/io.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class poisson_distribution
+
+// template <class CharT, class Traits, class IntType>
+// basic_ostream<CharT, Traits>&
+// operator<<(basic_ostream<CharT, Traits>& os,
+// const poisson_distribution<RealType>& x);
+
+// template <class CharT, class Traits, class IntType>
+// basic_istream<CharT, Traits>&
+// operator>>(basic_istream<CharT, Traits>& is,
+// poisson_distribution<RealType>& x);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::poisson_distribution<> D;
+ D d1(7);
+ std::ostringstream os;
+ os << d1;
+ std::istringstream is(os.str());
+ D d2;
+ is >> d2;
+ assert(d1 == d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/max.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/max.pass.cpp
new file mode 100644
index 000000000000..2dffab3d15fc
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/max.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class poisson_distribution
+
+// result_type max() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::poisson_distribution<> D;
+ D d(.25);
+ D::result_type m = d.max();
+ assert(m == std::numeric_limits<int>::max());
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/min.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/min.pass.cpp
new file mode 100644
index 000000000000..607d49b0e8bc
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/min.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class poisson_distribution
+
+// result_type min() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::poisson_distribution<> D;
+ D d(.5);
+ assert(d.min() == 0);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/param_assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/param_assign.pass.cpp
new file mode 100644
index 000000000000..1c31ea34a07c
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/param_assign.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class poisson_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::poisson_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p0(.7);
+ param_type p;
+ p = p0;
+ assert(p.mean() == .7);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/param_copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/param_copy.pass.cpp
new file mode 100644
index 000000000000..19c05136e3f4
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/param_copy.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class poisson_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::poisson_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p0(.125);
+ param_type p = p0;
+ assert(p.mean() == .125);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/param_ctor.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/param_ctor.pass.cpp
new file mode 100644
index 000000000000..081e3a2d5551
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/param_ctor.pass.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class poisson_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::poisson_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p;
+ assert(p.mean() == 1);
+ }
+ {
+ typedef std::poisson_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p(10);
+ assert(p.mean() == 10);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/param_eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/param_eq.pass.cpp
new file mode 100644
index 000000000000..cbee35845063
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/param_eq.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class poisson_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::poisson_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p1(0.75);
+ param_type p2(0.75);
+ assert(p1 == p2);
+ }
+ {
+ typedef std::poisson_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p1(0.75);
+ param_type p2(0.5);
+ assert(p1 != p2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/param_types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/param_types.pass.cpp
new file mode 100644
index 000000000000..c3136e048e03
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/param_types.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class poisson_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::poisson_distribution<> D;
+ typedef D::param_type param_type;
+ typedef param_type::distribution_type distribution_type;
+ static_assert((std::is_same<D, distribution_type>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/set_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/set_param.pass.cpp
new file mode 100644
index 000000000000..86fe1f422a3a
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/set_param.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class poisson_distribution;
+
+// void param(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::poisson_distribution<> D;
+ typedef D::param_type P;
+ P p(0.25);
+ D d(0.75);
+ d.param(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/types.pass.cpp
new file mode 100644
index 000000000000..05e8b112e5b3
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/types.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class poisson_distribution
+// {
+// public:
+// // types
+// typedef RealType result_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::poisson_distribution<> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, int>::value), "");
+ }
+ {
+ typedef std::poisson_distribution<unsigned long long> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, unsigned long long>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/assign.pass.cpp
new file mode 100644
index 000000000000..31a2c4ad6899
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/assign.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class weibull_distribution
+
+// weibull_distribution& operator=(const weibull_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::weibull_distribution<> D;
+ D d1(20, 0.75);
+ D d2;
+ assert(d1 != d2);
+ d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/copy.pass.cpp
new file mode 100644
index 000000000000..68ef4dfea51b
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/copy.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class weibull_distribution
+
+// weibull_distribution(const weibull_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::weibull_distribution<> D;
+ D d1(20, 1.75);
+ D d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/ctor_double_double.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/ctor_double_double.pass.cpp
new file mode 100644
index 000000000000..34c6705641c4
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/ctor_double_double.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class weibull_distribution
+
+// explicit weibull_distribution(result_type a = 0, result_type b = 1);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::weibull_distribution<> D;
+ D d;
+ assert(d.a() == 1);
+ assert(d.b() == 1);
+ }
+ {
+ typedef std::weibull_distribution<> D;
+ D d(14.5);
+ assert(d.a() == 14.5);
+ assert(d.b() == 1);
+ }
+ {
+ typedef std::weibull_distribution<> D;
+ D d(14.5, 5.25);
+ assert(d.a() == 14.5);
+ assert(d.b() == 5.25);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/ctor_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/ctor_param.pass.cpp
new file mode 100644
index 000000000000..5db4f1da7ef9
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/ctor_param.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class weibull_distribution
+
+// explicit weibull_distribution(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::weibull_distribution<> D;
+ typedef D::param_type P;
+ P p(0.25, 10);
+ D d(p);
+ assert(d.a() == 0.25);
+ assert(d.b() == 10);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eq.pass.cpp
new file mode 100644
index 000000000000..4c681c18b2f4
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eq.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class weibull_distribution
+
+// bool operator=(const weibull_distribution& x,
+// const weibull_distribution& y);
+// bool operator!(const weibull_distribution& x,
+// const weibull_distribution& y);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::weibull_distribution<> D;
+ D d1(2.5, 4);
+ D d2(2.5, 4);
+ assert(d1 == d2);
+ }
+ {
+ typedef std::weibull_distribution<> D;
+ D d1(2.5, 4);
+ D d2(2.5, 4.5);
+ assert(d1 != d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eval.pass.cpp
new file mode 100644
index 000000000000..e414932dc870
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eval.pass.cpp
@@ -0,0 +1,166 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class RealType = double>
+// class weibull_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g);
+
+#include <random>
+#include <cassert>
+#include <vector>
+#include <numeric>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x * x;
+}
+
+int main()
+{
+ {
+ typedef std::weibull_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(0.5, 2);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.b() * std::tgamma(1 + 1/d.a());
+ double x_var = sqr(d.b()) * std::tgamma(1 + 2/d.a()) - sqr(x_mean);
+ double x_skew = (sqr(d.b())*d.b() * std::tgamma(1 + 3/d.a()) -
+ 3*x_mean*x_var - sqr(x_mean)*x_mean) /
+ (std::sqrt(x_var)*x_var);
+ double x_kurtosis = (sqr(sqr(d.b())) * std::tgamma(1 + 4/d.a()) -
+ 4*x_skew*x_var*sqrt(x_var)*x_mean -
+ 6*sqr(x_mean)*x_var - sqr(sqr(x_mean))) / sqr(x_var) - 3;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
+ }
+ {
+ typedef std::weibull_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(1, .5);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.b() * std::tgamma(1 + 1/d.a());
+ double x_var = sqr(d.b()) * std::tgamma(1 + 2/d.a()) - sqr(x_mean);
+ double x_skew = (sqr(d.b())*d.b() * std::tgamma(1 + 3/d.a()) -
+ 3*x_mean*x_var - sqr(x_mean)*x_mean) /
+ (std::sqrt(x_var)*x_var);
+ double x_kurtosis = (sqr(sqr(d.b())) * std::tgamma(1 + 4/d.a()) -
+ 4*x_skew*x_var*sqrt(x_var)*x_mean -
+ 6*sqr(x_mean)*x_var - sqr(sqr(x_mean))) / sqr(x_var) - 3;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::weibull_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(2, 3);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.b() * std::tgamma(1 + 1/d.a());
+ double x_var = sqr(d.b()) * std::tgamma(1 + 2/d.a()) - sqr(x_mean);
+ double x_skew = (sqr(d.b())*d.b() * std::tgamma(1 + 3/d.a()) -
+ 3*x_mean*x_var - sqr(x_mean)*x_mean) /
+ (std::sqrt(x_var)*x_var);
+ double x_kurtosis = (sqr(sqr(d.b())) * std::tgamma(1 + 4/d.a()) -
+ 4*x_skew*x_var*sqrt(x_var)*x_mean -
+ 6*sqr(x_mean)*x_var - sqr(sqr(x_mean))) / sqr(x_var) - 3;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eval_param.pass.cpp
new file mode 100644
index 000000000000..6da705eb26c7
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eval_param.pass.cpp
@@ -0,0 +1,169 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class RealType = double>
+// class weibull_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
+
+#include <random>
+#include <cassert>
+#include <vector>
+#include <numeric>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x * x;
+}
+
+int main()
+{
+ {
+ typedef std::weibull_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(0.5, 2);
+ P p(1, .5);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ assert(d.min() <= v);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = p.b() * std::tgamma(1 + 1/p.a());
+ double x_var = sqr(p.b()) * std::tgamma(1 + 2/p.a()) - sqr(x_mean);
+ double x_skew = (sqr(p.b())*p.b() * std::tgamma(1 + 3/p.a()) -
+ 3*x_mean*x_var - sqr(x_mean)*x_mean) /
+ (std::sqrt(x_var)*x_var);
+ double x_kurtosis = (sqr(sqr(p.b())) * std::tgamma(1 + 4/p.a()) -
+ 4*x_skew*x_var*sqrt(x_var)*x_mean -
+ 6*sqr(x_mean)*x_var - sqr(sqr(x_mean))) / sqr(x_var) - 3;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::weibull_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(1, .5);
+ P p(2, 3);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ assert(d.min() <= v);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = p.b() * std::tgamma(1 + 1/p.a());
+ double x_var = sqr(p.b()) * std::tgamma(1 + 2/p.a()) - sqr(x_mean);
+ double x_skew = (sqr(p.b())*p.b() * std::tgamma(1 + 3/p.a()) -
+ 3*x_mean*x_var - sqr(x_mean)*x_mean) /
+ (std::sqrt(x_var)*x_var);
+ double x_kurtosis = (sqr(sqr(p.b())) * std::tgamma(1 + 4/p.a()) -
+ 4*x_skew*x_var*sqrt(x_var)*x_mean -
+ 6*sqr(x_mean)*x_var - sqr(sqr(x_mean))) / sqr(x_var) - 3;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
+ }
+ {
+ typedef std::weibull_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937 G;
+ G g;
+ D d(2, 3);
+ P p(.5, 2);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ assert(d.min() <= v);
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = p.b() * std::tgamma(1 + 1/p.a());
+ double x_var = sqr(p.b()) * std::tgamma(1 + 2/p.a()) - sqr(x_mean);
+ double x_skew = (sqr(p.b())*p.b() * std::tgamma(1 + 3/p.a()) -
+ 3*x_mean*x_var - sqr(x_mean)*x_mean) /
+ (std::sqrt(x_var)*x_var);
+ double x_kurtosis = (sqr(sqr(p.b())) * std::tgamma(1 + 4/p.a()) -
+ 4*x_skew*x_var*sqrt(x_var)*x_mean -
+ 6*sqr(x_mean)*x_var - sqr(sqr(x_mean))) / sqr(x_var) - 3;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/get_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/get_param.pass.cpp
new file mode 100644
index 000000000000..5047a93e663e
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/get_param.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class weibull_distribution
+
+// param_type param() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::weibull_distribution<> D;
+ typedef D::param_type P;
+ P p(.125, .5);
+ D d(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/io.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/io.pass.cpp
new file mode 100644
index 000000000000..73b9aedbacf6
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/io.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class weibull_distribution
+
+// template <class CharT, class Traits, class RealType>
+// basic_ostream<CharT, Traits>&
+// operator<<(basic_ostream<CharT, Traits>& os,
+// const weibull_distribution<RealType>& x);
+
+// template <class CharT, class Traits, class RealType>
+// basic_istream<CharT, Traits>&
+// operator>>(basic_istream<CharT, Traits>& is,
+// weibull_distribution<RealType>& x);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::weibull_distribution<> D;
+ D d1(7, 5);
+ std::ostringstream os;
+ os << d1;
+ std::istringstream is(os.str());
+ D d2;
+ is >> d2;
+ assert(d1 == d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/max.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/max.pass.cpp
new file mode 100644
index 000000000000..d3a44b305aa6
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/max.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class weibull_distribution
+
+// result_type max() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::weibull_distribution<> D;
+ D d(5, .25);
+ D::result_type m = d.max();
+ assert(m == INFINITY);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/min.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/min.pass.cpp
new file mode 100644
index 000000000000..fee46ab51ea8
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/min.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class weibull_distribution
+
+// result_type min() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::weibull_distribution<> D;
+ D d(.5, .5);
+ assert(d.min() == 0);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/param_assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/param_assign.pass.cpp
new file mode 100644
index 000000000000..2d978cda24b6
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/param_assign.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class weibull_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::weibull_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p0(.75, 6);
+ param_type p;
+ p = p0;
+ assert(p.a() == .75);
+ assert(p.b() == 6);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/param_copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/param_copy.pass.cpp
new file mode 100644
index 000000000000..815a2c732674
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/param_copy.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class weibull_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::weibull_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p0(10, .125);
+ param_type p = p0;
+ assert(p.a() == 10);
+ assert(p.b() == .125);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/param_ctor.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/param_ctor.pass.cpp
new file mode 100644
index 000000000000..3f9e29f8d7c5
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/param_ctor.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class weibull_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::weibull_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p;
+ assert(p.a() == 1);
+ assert(p.b() == 1);
+ }
+ {
+ typedef std::weibull_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p(10);
+ assert(p.a() == 10);
+ assert(p.b() == 1);
+ }
+ {
+ typedef std::weibull_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p(10, 5);
+ assert(p.a() == 10);
+ assert(p.b() == 5);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/param_eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/param_eq.pass.cpp
new file mode 100644
index 000000000000..b94e6c19b474
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/param_eq.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class weibull_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::weibull_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p1(0.75, .5);
+ param_type p2(0.75, .5);
+ assert(p1 == p2);
+ }
+ {
+ typedef std::weibull_distribution<> D;
+ typedef D::param_type param_type;
+ param_type p1(0.75, .5);
+ param_type p2(0.5, .5);
+ assert(p1 != p2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/param_types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/param_types.pass.cpp
new file mode 100644
index 000000000000..102f68d4774e
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/param_types.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class weibull_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::weibull_distribution<> D;
+ typedef D::param_type param_type;
+ typedef param_type::distribution_type distribution_type;
+ static_assert((std::is_same<D, distribution_type>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/set_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/set_param.pass.cpp
new file mode 100644
index 000000000000..b200e43c5e08
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/set_param.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class weibull_distribution;
+
+// void param(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::weibull_distribution<> D;
+ typedef D::param_type P;
+ P p(0.25, 5.5);
+ D d(0.75, 4);
+ d.param(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/types.pass.cpp
new file mode 100644
index 000000000000..6f82c70473ea
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/types.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class weibull_distribution
+// {
+// public:
+// // types
+// typedef RealType result_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::weibull_distribution<> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, double>::value), "");
+ }
+ {
+ typedef std::weibull_distribution<float> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, float>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/nothing_to_do.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..b58f5c55b643
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/assign.pass.cpp
new file mode 100644
index 000000000000..aee3f74f26c8
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/assign.pass.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class discrete_distribution
+
+// discrete_distribution& operator=(const discrete_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::discrete_distribution<> D;
+ double p[] = {2, 4, 1, 8};
+ D d1(p, p+4);
+ D d2;
+ assert(d1 != d2);
+ d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/copy.pass.cpp
new file mode 100644
index 000000000000..b133ac708da1
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/copy.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class discrete_distribution
+
+// discrete_distribution(const discrete_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::discrete_distribution<> D;
+ double p[] = {2, 4, 1, 8};
+ D d1(p, p+4);
+ D d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/ctor_default.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/ctor_default.pass.cpp
new file mode 100644
index 000000000000..3c1ed6a186e1
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/ctor_default.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class discrete_distribution
+
+// discrete_distribution();
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::discrete_distribution<> D;
+ D d;
+ std::vector<double> p = d.probabilities();
+ assert(p.size() == 1);
+ assert(p[0] == 1);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/ctor_func.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/ctor_func.pass.cpp
new file mode 100644
index 000000000000..34af69382c18
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/ctor_func.pass.cpp
@@ -0,0 +1,60 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class discrete_distribution
+
+// template<class UnaryOperation>
+// discrete_distribution(size_t nw, double xmin, double xmax,
+// UnaryOperation fw);
+
+#include <random>
+#include <cassert>
+
+double fw(double x)
+{
+ return x+1;
+}
+
+int main()
+{
+ {
+ typedef std::discrete_distribution<> D;
+ D d(0, 0, 1, fw);
+ std::vector<double> p = d.probabilities();
+ assert(p.size() == 1);
+ assert(p[0] == 1);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ D d(1, 0, 1, fw);
+ std::vector<double> p = d.probabilities();
+ assert(p.size() == 1);
+ assert(p[0] == 1);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ D d(2, 0.5, 1.5, fw);
+ std::vector<double> p = d.probabilities();
+ assert(p.size() == 2);
+ assert(p[0] == .4375);
+ assert(p[1] == .5625);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ D d(4, 0, 2, fw);
+ std::vector<double> p = d.probabilities();
+ assert(p.size() == 4);
+ assert(p[0] == .15625);
+ assert(p[1] == .21875);
+ assert(p[2] == .28125);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/ctor_init.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/ctor_init.pass.cpp
new file mode 100644
index 000000000000..bc4494b9848e
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/ctor_init.pass.cpp
@@ -0,0 +1,81 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class discrete_distribution
+
+// discrete_distribution(initializer_list<double> wl);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
+ typedef std::discrete_distribution<> D;
+ D d = {};
+ std::vector<double> p = d.probabilities();
+ assert(p.size() == 1);
+ assert(p[0] == 1);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ D d = {10};
+ std::vector<double> p = d.probabilities();
+ assert(p.size() == 1);
+ assert(p[0] == 1);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ D d = {10, 30};
+ std::vector<double> p = d.probabilities();
+ assert(p.size() == 2);
+ assert(p[0] == 0.25);
+ assert(p[1] == 0.75);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ D d = {30, 10};
+ std::vector<double> p = d.probabilities();
+ assert(p.size() == 2);
+ assert(p[0] == 0.75);
+ assert(p[1] == 0.25);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ D d = {30, 0, 10};
+ std::vector<double> p = d.probabilities();
+ assert(p.size() == 3);
+ assert(p[0] == 0.75);
+ assert(p[1] == 0);
+ assert(p[2] == 0.25);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ D d = {0, 30, 10};
+ std::vector<double> p = d.probabilities();
+ assert(p.size() == 3);
+ assert(p[0] == 0);
+ assert(p[1] == 0.75);
+ assert(p[2] == 0.25);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ D d = {0, 0, 10};
+ std::vector<double> p = d.probabilities();
+ assert(p.size() == 3);
+ assert(p[0] == 0);
+ assert(p[1] == 0);
+ assert(p[2] == 1);
+ }
+#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/ctor_iterator.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/ctor_iterator.pass.cpp
new file mode 100644
index 000000000000..65e14eeed2a9
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/ctor_iterator.pass.cpp
@@ -0,0 +1,87 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class discrete_distribution
+
+// template<class InputIterator>
+// discrete_distribution(InputIterator firstW, InputIterator lastW);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::discrete_distribution<> D;
+ double p0[] = {1};
+ D d(p0, p0);
+ std::vector<double> p = d.probabilities();
+ assert(p.size() == 1);
+ assert(p[0] == 1);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ double p0[] = {10};
+ D d(p0, p0+1);
+ std::vector<double> p = d.probabilities();
+ assert(p.size() == 1);
+ assert(p[0] == 1);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ double p0[] = {10, 30};
+ D d(p0, p0+2);
+ std::vector<double> p = d.probabilities();
+ assert(p.size() == 2);
+ assert(p[0] == 0.25);
+ assert(p[1] == 0.75);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ double p0[] = {30, 10};
+ D d(p0, p0+2);
+ std::vector<double> p = d.probabilities();
+ assert(p.size() == 2);
+ assert(p[0] == 0.75);
+ assert(p[1] == 0.25);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ double p0[] = {30, 0, 10};
+ D d(p0, p0+3);
+ std::vector<double> p = d.probabilities();
+ assert(p.size() == 3);
+ assert(p[0] == 0.75);
+ assert(p[1] == 0);
+ assert(p[2] == 0.25);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ double p0[] = {0, 30, 10};
+ D d(p0, p0+3);
+ std::vector<double> p = d.probabilities();
+ assert(p.size() == 3);
+ assert(p[0] == 0);
+ assert(p[1] == 0.75);
+ assert(p[2] == 0.25);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ double p0[] = {0, 0, 10};
+ D d(p0, p0+3);
+ std::vector<double> p = d.probabilities();
+ assert(p.size() == 3);
+ assert(p[0] == 0);
+ assert(p[1] == 0);
+ assert(p[2] == 1);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/ctor_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/ctor_param.pass.cpp
new file mode 100644
index 000000000000..c12fe45db92b
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/ctor_param.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class discrete_distribution
+
+// explicit discrete_distribution(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::discrete_distribution<> D;
+ typedef D::param_type P;
+ double p0[] = {10, 30};
+ P pa(p0, p0+2);
+ D d(pa);
+ std::vector<double> p = d.probabilities();
+ assert(p.size() == 2);
+ assert(p[0] == 0.25);
+ assert(p[1] == 0.75);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/eq.pass.cpp
new file mode 100644
index 000000000000..bad06987b0ca
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/eq.pass.cpp
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class discrete_distribution
+
+// bool operator=(const discrete_distribution& x,
+// const discrete_distribution& y);
+// bool operator!(const discrete_distribution& x,
+// const discrete_distribution& y);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::discrete_distribution<> D;
+ D d1;
+ D d2;
+ assert(d1 == d2);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ double p0[] = {1};
+ D d1(p0, p0+1);
+ D d2;
+ assert(d1 == d2);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ double p0[] = {10, 30};
+ D d1(p0, p0+2);
+ D d2;
+ assert(d1 != d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/eval.pass.cpp
new file mode 100644
index 000000000000..55080b252028
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/eval.pass.cpp
@@ -0,0 +1,279 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class IntType = int>
+// class discrete_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g);
+
+#include <random>
+#include <vector>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::discrete_distribution<> D;
+ typedef std::minstd_rand G;
+ G g;
+ D d;
+ const int N = 100;
+ std::vector<D::result_type> u(d.max()+1);
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u[v]++;
+ }
+ std::vector<double> prob = d.probabilities();
+ for (int i = 0; i <= d.max(); ++i)
+ assert((double)u[i]/N == prob[i]);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ typedef std::minstd_rand G;
+ G g;
+ double p0[] = {.3};
+ D d(p0, p0+1);
+ const int N = 100;
+ std::vector<D::result_type> u(d.max()+1);
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u[v]++;
+ }
+ std::vector<double> prob = d.probabilities();
+ for (int i = 0; i <= d.max(); ++i)
+ assert((double)u[i]/N == prob[i]);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ typedef std::minstd_rand G;
+ G g;
+ double p0[] = {.75, .25};
+ D d(p0, p0+2);
+ const int N = 1000000;
+ std::vector<D::result_type> u(d.max()+1);
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u[v]++;
+ }
+ std::vector<double> prob = d.probabilities();
+ for (int i = 0; i <= d.max(); ++i)
+ assert(std::abs((double)u[i]/N - prob[i]) / prob[i] < 0.001);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ typedef std::minstd_rand G;
+ G g;
+ double p0[] = {0, 1};
+ D d(p0, p0+2);
+ const int N = 1000000;
+ std::vector<D::result_type> u(d.max()+1);
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u[v]++;
+ }
+ std::vector<double> prob = d.probabilities();
+ assert((double)u[0]/N == prob[0]);
+ assert((double)u[1]/N == prob[1]);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ typedef std::minstd_rand G;
+ G g;
+ double p0[] = {1, 0};
+ D d(p0, p0+2);
+ const int N = 1000000;
+ std::vector<D::result_type> u(d.max()+1);
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u[v]++;
+ }
+ std::vector<double> prob = d.probabilities();
+ assert((double)u[0]/N == prob[0]);
+ assert((double)u[1]/N == prob[1]);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ typedef std::minstd_rand G;
+ G g;
+ double p0[] = {.3, .1, .6};
+ D d(p0, p0+3);
+ const int N = 10000000;
+ std::vector<D::result_type> u(d.max()+1);
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u[v]++;
+ }
+ std::vector<double> prob = d.probabilities();
+ for (int i = 0; i <= d.max(); ++i)
+ assert(std::abs((double)u[i]/N - prob[i]) / prob[i] < 0.001);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ typedef std::minstd_rand G;
+ G g;
+ double p0[] = {0, 25, 75};
+ D d(p0, p0+3);
+ const int N = 1000000;
+ std::vector<D::result_type> u(d.max()+1);
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u[v]++;
+ }
+ std::vector<double> prob = d.probabilities();
+ for (int i = 0; i <= d.max(); ++i)
+ if (prob[i] != 0)
+ assert(std::abs((double)u[i]/N - prob[i]) / prob[i] < 0.001);
+ else
+ assert(u[i] == 0);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ typedef std::minstd_rand G;
+ G g;
+ double p0[] = {25, 0, 75};
+ D d(p0, p0+3);
+ const int N = 1000000;
+ std::vector<D::result_type> u(d.max()+1);
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u[v]++;
+ }
+ std::vector<double> prob = d.probabilities();
+ for (int i = 0; i <= d.max(); ++i)
+ if (prob[i] != 0)
+ assert(std::abs((double)u[i]/N - prob[i]) / prob[i] < 0.001);
+ else
+ assert(u[i] == 0);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ typedef std::minstd_rand G;
+ G g;
+ double p0[] = {25, 75, 0};
+ D d(p0, p0+3);
+ const int N = 1000000;
+ std::vector<D::result_type> u(d.max()+1);
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u[v]++;
+ }
+ std::vector<double> prob = d.probabilities();
+ for (int i = 0; i <= d.max(); ++i)
+ if (prob[i] != 0)
+ assert(std::abs((double)u[i]/N - prob[i]) / prob[i] < 0.001);
+ else
+ assert(u[i] == 0);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ typedef std::minstd_rand G;
+ G g;
+ double p0[] = {0, 0, 1};
+ D d(p0, p0+3);
+ const int N = 100;
+ std::vector<D::result_type> u(d.max()+1);
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u[v]++;
+ }
+ std::vector<double> prob = d.probabilities();
+ for (int i = 0; i <= d.max(); ++i)
+ if (prob[i] != 0)
+ assert(std::abs((double)u[i]/N - prob[i]) / prob[i] < 0.001);
+ else
+ assert(u[i] == 0);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ typedef std::minstd_rand G;
+ G g;
+ double p0[] = {0, 1, 0};
+ D d(p0, p0+3);
+ const int N = 100;
+ std::vector<D::result_type> u(d.max()+1);
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u[v]++;
+ }
+ std::vector<double> prob = d.probabilities();
+ for (int i = 0; i <= d.max(); ++i)
+ if (prob[i] != 0)
+ assert(std::abs((double)u[i]/N - prob[i]) / prob[i] < 0.001);
+ else
+ assert(u[i] == 0);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ typedef std::minstd_rand G;
+ G g;
+ double p0[] = {1, 0, 0};
+ D d(p0, p0+3);
+ const int N = 100;
+ std::vector<D::result_type> u(d.max()+1);
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u[v]++;
+ }
+ std::vector<double> prob = d.probabilities();
+ for (int i = 0; i <= d.max(); ++i)
+ if (prob[i] != 0)
+ assert(std::abs((double)u[i]/N - prob[i]) / prob[i] < 0.001);
+ else
+ assert(u[i] == 0);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ typedef std::minstd_rand G;
+ G g;
+ double p0[] = {33, 0, 0, 67};
+ D d(p0, p0+3);
+ const int N = 1000000;
+ std::vector<D::result_type> u(d.max()+1);
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v <= d.max());
+ u[v]++;
+ }
+ std::vector<double> prob = d.probabilities();
+ for (int i = 0; i <= d.max(); ++i)
+ if (prob[i] != 0)
+ assert(std::abs((double)u[i]/N - prob[i]) / prob[i] < 0.001);
+ else
+ assert(u[i] == 0);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/eval_param.pass.cpp
new file mode 100644
index 000000000000..8d8a22424091
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/eval_param.pass.cpp
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class IntType = int>
+// class discrete_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
+
+#include <random>
+#include <vector>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::discrete_distribution<> D;
+ typedef D::param_type P;
+ typedef std::minstd_rand G;
+ G g;
+ D d;
+ double p0[] = {.3, .1, .6};
+ P p(p0, p0+3);
+ const int N = 10000000;
+ std::vector<D::result_type> u(3);
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ assert(0 <= v && v <= 2);
+ u[v]++;
+ }
+ std::vector<double> prob = p.probabilities();
+ for (int i = 0; i <= 2; ++i)
+ assert(std::abs((double)u[i]/N - prob[i]) / prob[i] < 0.001);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/get_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/get_param.pass.cpp
new file mode 100644
index 000000000000..4970c5aae404
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/get_param.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class discrete_distribution
+
+// param_type param() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::discrete_distribution<> D;
+ typedef D::param_type P;
+ double p0[] = {.3, .1, .6};
+ P p(p0, p0+3);
+ D d(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/io.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/io.pass.cpp
new file mode 100644
index 000000000000..92499501659d
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/io.pass.cpp
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class discrete_distribution
+
+// template <class charT, class traits>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& os,
+// const discrete_distribution& x);
+//
+// template <class charT, class traits>
+// basic_istream<charT, traits>&
+// operator>>(basic_istream<charT, traits>& is,
+// discrete_distribution& x);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::discrete_distribution<> D;
+ double p0[] = {.3, .1, .6};
+ D d1(p0, p0+3);
+ std::ostringstream os;
+ os << d1;
+ std::istringstream is(os.str());
+ D d2;
+ is >> d2;
+ assert(d1 == d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/max.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/max.pass.cpp
new file mode 100644
index 000000000000..b1d1acdab503
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/max.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class discrete_distribution
+
+// result_type max() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::discrete_distribution<> D;
+ double p0[] = {.3, .1, .6};
+ D d(p0, p0+3);
+ assert(d.max() == 2);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ double p0[] = {.3, .1, .6, .2};
+ D d(p0, p0+4);
+ assert(d.max() == 3);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/min.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/min.pass.cpp
new file mode 100644
index 000000000000..ab9383238140
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/min.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class discrete_distribution
+
+// result_type min() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::discrete_distribution<> D;
+ double p0[] = {.3, .1, .6};
+ D d(p0, p0+3);
+ assert(d.min() == 0);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_assign.pass.cpp
new file mode 100644
index 000000000000..ea57852b62cd
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_assign.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class discrete_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::discrete_distribution<> D;
+ typedef D::param_type param_type;
+ double d0[] = {.3, .1, .6};
+ param_type p0(d0, d0+3);
+ param_type p;
+ p = p0;
+ assert(p == p0);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_copy.pass.cpp
new file mode 100644
index 000000000000..b65ebb0d8c73
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_copy.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class discrete_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::discrete_distribution<> D;
+ typedef D::param_type param_type;
+ double d0[] = {.3, .1, .6};
+ param_type p0(d0, d0+3);
+ param_type p = p0;
+ assert(p == p0);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_default.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_default.pass.cpp
new file mode 100644
index 000000000000..1071305f4db7
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_default.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class discrete_distribution
+
+// param_type(initializer_list<double> wl);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
+ typedef std::discrete_distribution<> D;
+ typedef D::param_type P;
+ P pa = {1};
+ std::vector<double> p = pa.probabilities();
+ assert(p.size() == 1);
+ assert(p[0] == 1);
+ }
+#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_func.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_func.pass.cpp
new file mode 100644
index 000000000000..6d43b2234fc2
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_func.pass.cpp
@@ -0,0 +1,64 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class discrete_distribution
+
+// template<class UnaryOperation>
+// param_type(size_t nw, double xmin, double xmax,
+// UnaryOperation fw);
+
+#include <random>
+#include <cassert>
+
+double fw(double x)
+{
+ return x+1;
+}
+
+int main()
+{
+ {
+ typedef std::discrete_distribution<> D;
+ typedef D::param_type P;
+ P pa(0, 0, 1, fw);
+ std::vector<double> p = pa.probabilities();
+ assert(p.size() == 1);
+ assert(p[0] == 1);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ typedef D::param_type P;
+ P pa(1, 0, 1, fw);
+ std::vector<double> p = pa.probabilities();
+ assert(p.size() == 1);
+ assert(p[0] == 1);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ typedef D::param_type P;
+ P pa(2, 0.5, 1.5, fw);
+ std::vector<double> p = pa.probabilities();
+ assert(p.size() == 2);
+ assert(p[0] == .4375);
+ assert(p[1] == .5625);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ typedef D::param_type P;
+ P pa(4, 0, 2, fw);
+ std::vector<double> p = pa.probabilities();
+ assert(p.size() == 4);
+ assert(p[0] == .15625);
+ assert(p[1] == .21875);
+ assert(p[2] == .28125);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_init.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_init.pass.cpp
new file mode 100644
index 000000000000..79d8a0b71a92
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_init.pass.cpp
@@ -0,0 +1,88 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class discrete_distribution
+
+// param_type(initializer_list<double> wl);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
+ typedef std::discrete_distribution<> D;
+ typedef D::param_type P;
+ P pa = {};
+ std::vector<double> p = pa.probabilities();
+ assert(p.size() == 1);
+ assert(p[0] == 1);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ typedef D::param_type P;
+ P pa = {10};
+ std::vector<double> p = pa.probabilities();
+ assert(p.size() == 1);
+ assert(p[0] == 1);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ typedef D::param_type P;
+ P pa = {10, 30};
+ std::vector<double> p = pa.probabilities();
+ assert(p.size() == 2);
+ assert(p[0] == 0.25);
+ assert(p[1] == 0.75);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ typedef D::param_type P;
+ P pa = {30, 10};
+ std::vector<double> p = pa.probabilities();
+ assert(p.size() == 2);
+ assert(p[0] == 0.75);
+ assert(p[1] == 0.25);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ typedef D::param_type P;
+ P pa = {30, 0, 10};
+ std::vector<double> p = pa.probabilities();
+ assert(p.size() == 3);
+ assert(p[0] == 0.75);
+ assert(p[1] == 0);
+ assert(p[2] == 0.25);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ typedef D::param_type P;
+ P pa = {0, 30, 10};
+ std::vector<double> p = pa.probabilities();
+ assert(p.size() == 3);
+ assert(p[0] == 0);
+ assert(p[1] == 0.75);
+ assert(p[2] == 0.25);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ typedef D::param_type P;
+ P pa = {0, 0, 10};
+ std::vector<double> p = pa.probabilities();
+ assert(p.size() == 3);
+ assert(p[0] == 0);
+ assert(p[1] == 0);
+ assert(p[2] == 1);
+ }
+#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_iterator.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_iterator.pass.cpp
new file mode 100644
index 000000000000..7ef646707c14
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_iterator.pass.cpp
@@ -0,0 +1,94 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class discrete_distribution
+
+// template<class InputIterator>
+// param_type(InputIterator firstW, InputIterator lastW);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::discrete_distribution<> D;
+ typedef D::param_type P;
+ double p0[] = {1};
+ P pa(p0, p0);
+ std::vector<double> p = pa.probabilities();
+ assert(p.size() == 1);
+ assert(p[0] == 1);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ typedef D::param_type P;
+ double p0[] = {10};
+ P pa(p0, p0+1);
+ std::vector<double> p = pa.probabilities();
+ assert(p.size() == 1);
+ assert(p[0] == 1);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ typedef D::param_type P;
+ double p0[] = {10, 30};
+ P pa(p0, p0+2);
+ std::vector<double> p = pa.probabilities();
+ assert(p.size() == 2);
+ assert(p[0] == 0.25);
+ assert(p[1] == 0.75);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ typedef D::param_type P;
+ double p0[] = {30, 10};
+ P pa(p0, p0+2);
+ std::vector<double> p = pa.probabilities();
+ assert(p.size() == 2);
+ assert(p[0] == 0.75);
+ assert(p[1] == 0.25);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ typedef D::param_type P;
+ double p0[] = {30, 0, 10};
+ P pa(p0, p0+3);
+ std::vector<double> p = pa.probabilities();
+ assert(p.size() == 3);
+ assert(p[0] == 0.75);
+ assert(p[1] == 0);
+ assert(p[2] == 0.25);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ typedef D::param_type P;
+ double p0[] = {0, 30, 10};
+ P pa(p0, p0+3);
+ std::vector<double> p = pa.probabilities();
+ assert(p.size() == 3);
+ assert(p[0] == 0);
+ assert(p[1] == 0.75);
+ assert(p[2] == 0.25);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ typedef D::param_type P;
+ double p0[] = {0, 0, 10};
+ P pa(p0, p0+3);
+ std::vector<double> p = pa.probabilities();
+ assert(p.size() == 3);
+ assert(p[0] == 0);
+ assert(p[1] == 0);
+ assert(p[2] == 1);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_eq.pass.cpp
new file mode 100644
index 000000000000..6ec2c2aad4b1
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_eq.pass.cpp
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class discrete_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::discrete_distribution<> D;
+ typedef D::param_type param_type;
+ double p0[] = {30, 10};
+ param_type p1(p0, p0+2);
+ param_type p2(p0, p0+2);
+ assert(p1 == p2);
+ }
+ {
+ typedef std::discrete_distribution<> D;
+ typedef D::param_type param_type;
+ double p0[] = {30, 10};
+ param_type p1(p0, p0+2);
+ param_type p2;
+ assert(p1 != p2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_types.pass.cpp
new file mode 100644
index 000000000000..086b7600feb0
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_types.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class discrete_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::discrete_distribution<> D;
+ typedef D::param_type param_type;
+ typedef param_type::distribution_type distribution_type;
+ static_assert((std::is_same<D, distribution_type>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/set_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/set_param.pass.cpp
new file mode 100644
index 000000000000..bc433ec75644
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/set_param.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class discrete_distribution
+
+// void param(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::discrete_distribution<> D;
+ typedef D::param_type P;
+ double d0[] = {.3, .1, .6};
+ P p(d0, d0+3);
+ D d;
+ d.param(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/types.pass.cpp
new file mode 100644
index 000000000000..af73008ff418
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/types.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class IntType = int>
+// class discrete_distribution
+// {
+// typedef bool result_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::discrete_distribution<> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, int>::value), "");
+ }
+ {
+ typedef std::discrete_distribution<long> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, long>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/assign.pass.cpp
new file mode 100644
index 000000000000..e5c994445d44
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/assign.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_constant_distribution
+
+// piecewise_constant_distribution& operator=(const piecewise_constant_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::piecewise_constant_distribution<> D;
+ double p[] = {2, 4, 1, 8};
+ double b[] = {2, 4, 5, 8, 9};
+ D d1(b, b+5, p);
+ D d2;
+ assert(d1 != d2);
+ d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/copy.pass.cpp
new file mode 100644
index 000000000000..a3eb1f4a5038
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/copy.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_constant_distribution
+
+// piecewise_constant_distribution(const piecewise_constant_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::piecewise_constant_distribution<> D;
+ double p[] = {2, 4, 1, 8};
+ double b[] = {2, 4, 5, 8, 9};
+ D d1(b, b+5, p);
+ D d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_default.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_default.pass.cpp
new file mode 100644
index 000000000000..d4f339fe7f3b
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_default.pass.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_constant_distribution
+
+// piecewise_constant_distribution(initializer_list<double> wl);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ D d;
+ std::vector<double> iv = d.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 0);
+ assert(iv[1] == 1);
+ std::vector<double> dn = d.densities();
+ assert(dn.size() == 1);
+ assert(dn[0] == 1);
+ }
+#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_func.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_func.pass.cpp
new file mode 100644
index 000000000000..74fa23442687
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_func.pass.cpp
@@ -0,0 +1,64 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_constant_distribution
+
+// template<class UnaryOperation>
+// piecewise_constant_distribution(size_t nw, result_type xmin,
+// result_type xmax, UnaryOperation fw);
+
+#include <random>
+#include <cassert>
+
+double fw(double x)
+{
+ return 2*x;
+}
+
+int main()
+{
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ D d(0, 0, 1, fw);
+ std::vector<double> iv = d.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 0);
+ assert(iv[1] == 1);
+ std::vector<double> dn = d.densities();
+ assert(dn.size() == 1);
+ assert(dn[0] == 1);
+ }
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ D d(1, 10, 12, fw);
+ std::vector<double> iv = d.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 10);
+ assert(iv[1] == 12);
+ std::vector<double> dn = d.densities();
+ assert(dn.size() == 1);
+ assert(dn[0] == 0.5);
+ }
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ D d(2, 6, 14, fw);
+ std::vector<double> iv = d.intervals();
+ assert(iv.size() == 3);
+ assert(iv[0] == 6);
+ assert(iv[1] == 10);
+ assert(iv[2] == 14);
+ std::vector<double> dn = d.densities();
+ assert(dn.size() == 2);
+ assert(dn[0] == 0.1);
+ assert(dn[1] == 0.15);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_init_func.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_init_func.pass.cpp
new file mode 100644
index 000000000000..5708e45093cb
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_init_func.pass.cpp
@@ -0,0 +1,78 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_constant_distribution
+
+// piecewise_constant_distribution(initializer_list<result_type> bl,
+// UnaryOperation fw);
+
+#include <iostream>
+
+#include <random>
+#include <cassert>
+
+double f(double x)
+{
+ return x*2;
+}
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ D d({}, f);
+ std::vector<double> iv = d.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 0);
+ assert(iv[1] == 1);
+ std::vector<double> dn = d.densities();
+ assert(dn.size() == 1);
+ assert(dn[0] == 1);
+ }
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ D d({12}, f);
+ std::vector<double> iv = d.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 0);
+ assert(iv[1] == 1);
+ std::vector<double> dn = d.densities();
+ assert(dn.size() == 1);
+ assert(dn[0] == 1);
+ }
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ D d({12, 14}, f);
+ std::vector<double> iv = d.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 12);
+ assert(iv[1] == 14);
+ std::vector<double> dn = d.densities();
+ assert(dn.size() == 1);
+ assert(dn[0] == 0.5);
+ }
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ D d({5.5, 7.5, 11.5}, f);
+ std::vector<double> iv = d.intervals();
+ assert(iv.size() == 3);
+ assert(iv[0] == 5.5);
+ assert(iv[1] == 7.5);
+ assert(iv[2] == 11.5);
+ std::vector<double> dn = d.densities();
+ assert(dn.size() == 2);
+ assert(dn[0] == 0.203125);
+ assert(dn[1] == 0.1484375);
+ }
+#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_iterator.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_iterator.pass.cpp
new file mode 100644
index 000000000000..d994b0a802b1
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_iterator.pass.cpp
@@ -0,0 +1,96 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_constant_distribution
+
+// template<class InputIterator>
+// piecewise_constant_distribution(InputIteratorB firstB,
+// InputIteratorB lastB,
+// InputIteratorW firstW);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ double b[] = {10};
+ double p[] = {12};
+ D d(b, b, p);
+ std::vector<double> iv = d.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 0);
+ assert(iv[1] == 1);
+ std::vector<double> dn = d.densities();
+ assert(dn.size() == 1);
+ assert(dn[0] == 1);
+ }
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ double b[] = {10};
+ double p[] = {12};
+ D d(b, b+1, p);
+ std::vector<double> iv = d.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 0);
+ assert(iv[1] == 1);
+ std::vector<double> dn = d.densities();
+ assert(dn.size() == 1);
+ assert(dn[0] == 1);
+ }
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ double b[] = {10, 15};
+ double p[] = {12};
+ D d(b, b+2, p);
+ std::vector<double> iv = d.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 10);
+ assert(iv[1] == 15);
+ std::vector<double> dn = d.densities();
+ assert(dn.size() == 1);
+ assert(dn[0] == 1/5.);
+ }
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ double b[] = {10, 15, 16};
+ double p[] = {.25, .75};
+ D d(b, b+3, p);
+ std::vector<double> iv = d.intervals();
+ assert(iv.size() == 3);
+ assert(iv[0] == 10);
+ assert(iv[1] == 15);
+ assert(iv[2] == 16);
+ std::vector<double> dn = d.densities();
+ assert(dn.size() == 2);
+ assert(dn[0] == .25/5.);
+ assert(dn[1] == .75);
+ }
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 62.5, 12.5};
+ D d(b, b+4, p);
+ std::vector<double> iv = d.intervals();
+ assert(iv.size() == 4);
+ assert(iv[0] == 10);
+ assert(iv[1] == 14);
+ assert(iv[2] == 16);
+ assert(iv[3] == 17);
+ std::vector<double> dn = d.densities();
+ assert(dn.size() == 3);
+ assert(dn[0] == .0625);
+ assert(dn[1] == .3125);
+ assert(dn[2] == .125);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_param.pass.cpp
new file mode 100644
index 000000000000..0ccdba6b964d
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_param.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_constant_distribution
+
+// explicit piecewise_constant_distribution(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ typedef D::param_type P;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 62.5, 12.5};
+ P pa(b, b+4, p);
+ D d(pa);
+ std::vector<double> iv = d.intervals();
+ assert(iv.size() == 4);
+ assert(iv[0] == 10);
+ assert(iv[1] == 14);
+ assert(iv[2] == 16);
+ assert(iv[3] == 17);
+ std::vector<double> dn = d.densities();
+ assert(dn.size() == 3);
+ assert(dn[0] == .0625);
+ assert(dn[1] == .3125);
+ assert(dn[2] == .125);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eq.pass.cpp
new file mode 100644
index 000000000000..2ef9d7b6e0f3
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eq.pass.cpp
@@ -0,0 +1,47 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_constant_distribution
+
+// bool operator=(const piecewise_constant_distribution& x,
+// const piecewise_constant_distribution& y);
+// bool operator!(const piecewise_constant_distribution& x,
+// const piecewise_constant_distribution& y);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ D d1;
+ D d2;
+ assert(d1 == d2);
+ }
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 62.5, 12.5};
+ D d1(b, b+4, p);
+ D d2(b, b+4, p);
+ assert(d1 == d2);
+ }
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 62.5, 12.5};
+ D d1(b, b+4, p);
+ D d2;
+ assert(d1 != d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval.pass.cpp
new file mode 100644
index 000000000000..5d14b3612b2e
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval.pass.cpp
@@ -0,0 +1,695 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_constant_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g);
+
+#include <random>
+#include <vector>
+#include <iterator>
+#include <numeric>
+#include <cassert>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x*x;
+}
+
+int main()
+{
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 62.5, 12.5};
+ const size_t Np = sizeof(p) / sizeof(p[0]);
+ D d(b, b+Np+1, p);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v < d.max());
+ u.push_back(v);
+ }
+ std::vector<double> prob(std::begin(p), std::end(p));
+ double s = std::accumulate(prob.begin(), prob.end(), 0.0);
+ for (int i = 0; i < prob.size(); ++i)
+ prob[i] /= s;
+ std::sort(u.begin(), u.end());
+ for (int i = 0; i < Np; ++i)
+ {
+ typedef std::vector<D::result_type>::iterator I;
+ I lb = std::lower_bound(u.begin(), u.end(), b[i]);
+ I ub = std::lower_bound(u.begin(), u.end(), b[i+1]);
+ const size_t Ni = ub - lb;
+ if (prob[i] == 0)
+ assert(Ni == 0);
+ else
+ {
+ assert(std::abs((double)Ni/N - prob[i]) / prob[i] < .01);
+ double mean = std::accumulate(lb, ub, 0.0) / Ni;
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (I j = lb; j != ub; ++j)
+ {
+ double d = (*j - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= Ni;
+ double dev = std::sqrt(var);
+ skew /= Ni * dev * var;
+ kurtosis /= Ni * var * var;
+ kurtosis -= 3;
+ double x_mean = (b[i+1] + b[i]) / 2;
+ double x_var = sqr(b[i+1] - b[i]) / 12;
+ double x_skew = 0;
+ double x_kurtosis = -6./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ }
+ }
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {0, 62.5, 12.5};
+ const size_t Np = sizeof(p) / sizeof(p[0]);
+ D d(b, b+Np+1, p);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v < d.max());
+ u.push_back(v);
+ }
+ std::vector<double> prob(std::begin(p), std::end(p));
+ double s = std::accumulate(prob.begin(), prob.end(), 0.0);
+ for (int i = 0; i < prob.size(); ++i)
+ prob[i] /= s;
+ std::sort(u.begin(), u.end());
+ for (int i = 0; i < Np; ++i)
+ {
+ typedef std::vector<D::result_type>::iterator I;
+ I lb = std::lower_bound(u.begin(), u.end(), b[i]);
+ I ub = std::lower_bound(u.begin(), u.end(), b[i+1]);
+ const size_t Ni = ub - lb;
+ if (prob[i] == 0)
+ assert(Ni == 0);
+ else
+ {
+ assert(std::abs((double)Ni/N - prob[i]) / prob[i] < .01);
+ double mean = std::accumulate(lb, ub, 0.0) / Ni;
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (I j = lb; j != ub; ++j)
+ {
+ double d = (*j - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= Ni;
+ double dev = std::sqrt(var);
+ skew /= Ni * dev * var;
+ kurtosis /= Ni * var * var;
+ kurtosis -= 3;
+ double x_mean = (b[i+1] + b[i]) / 2;
+ double x_var = sqr(b[i+1] - b[i]) / 12;
+ double x_skew = 0;
+ double x_kurtosis = -6./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ }
+ }
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 0, 12.5};
+ const size_t Np = sizeof(p) / sizeof(p[0]);
+ D d(b, b+Np+1, p);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v < d.max());
+ u.push_back(v);
+ }
+ std::vector<double> prob(std::begin(p), std::end(p));
+ double s = std::accumulate(prob.begin(), prob.end(), 0.0);
+ for (int i = 0; i < prob.size(); ++i)
+ prob[i] /= s;
+ std::sort(u.begin(), u.end());
+ for (int i = 0; i < Np; ++i)
+ {
+ typedef std::vector<D::result_type>::iterator I;
+ I lb = std::lower_bound(u.begin(), u.end(), b[i]);
+ I ub = std::lower_bound(u.begin(), u.end(), b[i+1]);
+ const size_t Ni = ub - lb;
+ if (prob[i] == 0)
+ assert(Ni == 0);
+ else
+ {
+ assert(std::abs((double)Ni/N - prob[i]) / prob[i] < .01);
+ double mean = std::accumulate(lb, ub, 0.0) / Ni;
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (I j = lb; j != ub; ++j)
+ {
+ double d = (*j - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= Ni;
+ double dev = std::sqrt(var);
+ skew /= Ni * dev * var;
+ kurtosis /= Ni * var * var;
+ kurtosis -= 3;
+ double x_mean = (b[i+1] + b[i]) / 2;
+ double x_var = sqr(b[i+1] - b[i]) / 12;
+ double x_skew = 0;
+ double x_kurtosis = -6./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ }
+ }
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 62.5, 0};
+ const size_t Np = sizeof(p) / sizeof(p[0]);
+ D d(b, b+Np+1, p);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v < d.max());
+ u.push_back(v);
+ }
+ std::vector<double> prob(std::begin(p), std::end(p));
+ double s = std::accumulate(prob.begin(), prob.end(), 0.0);
+ for (int i = 0; i < prob.size(); ++i)
+ prob[i] /= s;
+ std::sort(u.begin(), u.end());
+ for (int i = 0; i < Np; ++i)
+ {
+ typedef std::vector<D::result_type>::iterator I;
+ I lb = std::lower_bound(u.begin(), u.end(), b[i]);
+ I ub = std::lower_bound(u.begin(), u.end(), b[i+1]);
+ const size_t Ni = ub - lb;
+ if (prob[i] == 0)
+ assert(Ni == 0);
+ else
+ {
+ assert(std::abs((double)Ni/N - prob[i]) / prob[i] < .01);
+ double mean = std::accumulate(lb, ub, 0.0) / Ni;
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (I j = lb; j != ub; ++j)
+ {
+ double d = (*j - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= Ni;
+ double dev = std::sqrt(var);
+ skew /= Ni * dev * var;
+ kurtosis /= Ni * var * var;
+ kurtosis -= 3;
+ double x_mean = (b[i+1] + b[i]) / 2;
+ double x_var = sqr(b[i+1] - b[i]) / 12;
+ double x_skew = 0;
+ double x_kurtosis = -6./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ }
+ }
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 0, 0};
+ const size_t Np = sizeof(p) / sizeof(p[0]);
+ D d(b, b+Np+1, p);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v < d.max());
+ u.push_back(v);
+ }
+ std::vector<double> prob(std::begin(p), std::end(p));
+ double s = std::accumulate(prob.begin(), prob.end(), 0.0);
+ for (int i = 0; i < prob.size(); ++i)
+ prob[i] /= s;
+ std::sort(u.begin(), u.end());
+ for (int i = 0; i < Np; ++i)
+ {
+ typedef std::vector<D::result_type>::iterator I;
+ I lb = std::lower_bound(u.begin(), u.end(), b[i]);
+ I ub = std::lower_bound(u.begin(), u.end(), b[i+1]);
+ const size_t Ni = ub - lb;
+ if (prob[i] == 0)
+ assert(Ni == 0);
+ else
+ {
+ assert(std::abs((double)Ni/N - prob[i]) / prob[i] < .01);
+ double mean = std::accumulate(lb, ub, 0.0) / Ni;
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (I j = lb; j != ub; ++j)
+ {
+ double d = (*j - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= Ni;
+ double dev = std::sqrt(var);
+ skew /= Ni * dev * var;
+ kurtosis /= Ni * var * var;
+ kurtosis -= 3;
+ double x_mean = (b[i+1] + b[i]) / 2;
+ double x_var = sqr(b[i+1] - b[i]) / 12;
+ double x_skew = 0;
+ double x_kurtosis = -6./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ }
+ }
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {0, 25, 0};
+ const size_t Np = sizeof(p) / sizeof(p[0]);
+ D d(b, b+Np+1, p);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v < d.max());
+ u.push_back(v);
+ }
+ std::vector<double> prob(std::begin(p), std::end(p));
+ double s = std::accumulate(prob.begin(), prob.end(), 0.0);
+ for (int i = 0; i < prob.size(); ++i)
+ prob[i] /= s;
+ std::sort(u.begin(), u.end());
+ for (int i = 0; i < Np; ++i)
+ {
+ typedef std::vector<D::result_type>::iterator I;
+ I lb = std::lower_bound(u.begin(), u.end(), b[i]);
+ I ub = std::lower_bound(u.begin(), u.end(), b[i+1]);
+ const size_t Ni = ub - lb;
+ if (prob[i] == 0)
+ assert(Ni == 0);
+ else
+ {
+ assert(std::abs((double)Ni/N - prob[i]) / prob[i] < .01);
+ double mean = std::accumulate(lb, ub, 0.0) / Ni;
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (I j = lb; j != ub; ++j)
+ {
+ double d = (*j - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= Ni;
+ double dev = std::sqrt(var);
+ skew /= Ni * dev * var;
+ kurtosis /= Ni * var * var;
+ kurtosis -= 3;
+ double x_mean = (b[i+1] + b[i]) / 2;
+ double x_var = sqr(b[i+1] - b[i]) / 12;
+ double x_skew = 0;
+ double x_kurtosis = -6./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ }
+ }
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {0, 0, 1};
+ const size_t Np = sizeof(p) / sizeof(p[0]);
+ D d(b, b+Np+1, p);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v < d.max());
+ u.push_back(v);
+ }
+ std::vector<double> prob(std::begin(p), std::end(p));
+ double s = std::accumulate(prob.begin(), prob.end(), 0.0);
+ for (int i = 0; i < prob.size(); ++i)
+ prob[i] /= s;
+ std::sort(u.begin(), u.end());
+ for (int i = 0; i < Np; ++i)
+ {
+ typedef std::vector<D::result_type>::iterator I;
+ I lb = std::lower_bound(u.begin(), u.end(), b[i]);
+ I ub = std::lower_bound(u.begin(), u.end(), b[i+1]);
+ const size_t Ni = ub - lb;
+ if (prob[i] == 0)
+ assert(Ni == 0);
+ else
+ {
+ assert(std::abs((double)Ni/N - prob[i]) / prob[i] < .01);
+ double mean = std::accumulate(lb, ub, 0.0) / Ni;
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (I j = lb; j != ub; ++j)
+ {
+ double d = (*j - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= Ni;
+ double dev = std::sqrt(var);
+ skew /= Ni * dev * var;
+ kurtosis /= Ni * var * var;
+ kurtosis -= 3;
+ double x_mean = (b[i+1] + b[i]) / 2;
+ double x_var = sqr(b[i+1] - b[i]) / 12;
+ double x_skew = 0;
+ double x_kurtosis = -6./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ }
+ }
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14, 16};
+ double p[] = {75, 25};
+ const size_t Np = sizeof(p) / sizeof(p[0]);
+ D d(b, b+Np+1, p);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v < d.max());
+ u.push_back(v);
+ }
+ std::vector<double> prob(std::begin(p), std::end(p));
+ double s = std::accumulate(prob.begin(), prob.end(), 0.0);
+ for (int i = 0; i < prob.size(); ++i)
+ prob[i] /= s;
+ std::sort(u.begin(), u.end());
+ for (int i = 0; i < Np; ++i)
+ {
+ typedef std::vector<D::result_type>::iterator I;
+ I lb = std::lower_bound(u.begin(), u.end(), b[i]);
+ I ub = std::lower_bound(u.begin(), u.end(), b[i+1]);
+ const size_t Ni = ub - lb;
+ if (prob[i] == 0)
+ assert(Ni == 0);
+ else
+ {
+ assert(std::abs((double)Ni/N - prob[i]) / prob[i] < .01);
+ double mean = std::accumulate(lb, ub, 0.0) / Ni;
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (I j = lb; j != ub; ++j)
+ {
+ double d = (*j - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= Ni;
+ double dev = std::sqrt(var);
+ skew /= Ni * dev * var;
+ kurtosis /= Ni * var * var;
+ kurtosis -= 3;
+ double x_mean = (b[i+1] + b[i]) / 2;
+ double x_var = sqr(b[i+1] - b[i]) / 12;
+ double x_skew = 0;
+ double x_kurtosis = -6./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ }
+ }
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14, 16};
+ double p[] = {0, 25};
+ const size_t Np = sizeof(p) / sizeof(p[0]);
+ D d(b, b+Np+1, p);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v < d.max());
+ u.push_back(v);
+ }
+ std::vector<double> prob(std::begin(p), std::end(p));
+ double s = std::accumulate(prob.begin(), prob.end(), 0.0);
+ for (int i = 0; i < prob.size(); ++i)
+ prob[i] /= s;
+ std::sort(u.begin(), u.end());
+ for (int i = 0; i < Np; ++i)
+ {
+ typedef std::vector<D::result_type>::iterator I;
+ I lb = std::lower_bound(u.begin(), u.end(), b[i]);
+ I ub = std::lower_bound(u.begin(), u.end(), b[i+1]);
+ const size_t Ni = ub - lb;
+ if (prob[i] == 0)
+ assert(Ni == 0);
+ else
+ {
+ assert(std::abs((double)Ni/N - prob[i]) / prob[i] < .01);
+ double mean = std::accumulate(lb, ub, 0.0) / Ni;
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (I j = lb; j != ub; ++j)
+ {
+ double d = (*j - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= Ni;
+ double dev = std::sqrt(var);
+ skew /= Ni * dev * var;
+ kurtosis /= Ni * var * var;
+ kurtosis -= 3;
+ double x_mean = (b[i+1] + b[i]) / 2;
+ double x_var = sqr(b[i+1] - b[i]) / 12;
+ double x_skew = 0;
+ double x_kurtosis = -6./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ }
+ }
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14, 16};
+ double p[] = {1, 0};
+ const size_t Np = sizeof(p) / sizeof(p[0]);
+ D d(b, b+Np+1, p);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v < d.max());
+ u.push_back(v);
+ }
+ std::vector<double> prob(std::begin(p), std::end(p));
+ double s = std::accumulate(prob.begin(), prob.end(), 0.0);
+ for (int i = 0; i < prob.size(); ++i)
+ prob[i] /= s;
+ std::sort(u.begin(), u.end());
+ for (int i = 0; i < Np; ++i)
+ {
+ typedef std::vector<D::result_type>::iterator I;
+ I lb = std::lower_bound(u.begin(), u.end(), b[i]);
+ I ub = std::lower_bound(u.begin(), u.end(), b[i+1]);
+ const size_t Ni = ub - lb;
+ if (prob[i] == 0)
+ assert(Ni == 0);
+ else
+ {
+ assert(std::abs((double)Ni/N - prob[i]) / prob[i] < .01);
+ double mean = std::accumulate(lb, ub, 0.0) / Ni;
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (I j = lb; j != ub; ++j)
+ {
+ double d = (*j - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= Ni;
+ double dev = std::sqrt(var);
+ skew /= Ni * dev * var;
+ kurtosis /= Ni * var * var;
+ kurtosis -= 3;
+ double x_mean = (b[i+1] + b[i]) / 2;
+ double x_var = sqr(b[i+1] - b[i]) / 12;
+ double x_skew = 0;
+ double x_kurtosis = -6./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ }
+ }
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14};
+ double p[] = {1};
+ const size_t Np = sizeof(p) / sizeof(p[0]);
+ D d(b, b+Np+1, p);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v < d.max());
+ u.push_back(v);
+ }
+ std::vector<double> prob(std::begin(p), std::end(p));
+ double s = std::accumulate(prob.begin(), prob.end(), 0.0);
+ for (int i = 0; i < prob.size(); ++i)
+ prob[i] /= s;
+ std::sort(u.begin(), u.end());
+ for (int i = 0; i < Np; ++i)
+ {
+ typedef std::vector<D::result_type>::iterator I;
+ I lb = std::lower_bound(u.begin(), u.end(), b[i]);
+ I ub = std::lower_bound(u.begin(), u.end(), b[i+1]);
+ const size_t Ni = ub - lb;
+ if (prob[i] == 0)
+ assert(Ni == 0);
+ else
+ {
+ assert(std::abs((double)Ni/N - prob[i]) / prob[i] < .01);
+ double mean = std::accumulate(lb, ub, 0.0) / Ni;
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (I j = lb; j != ub; ++j)
+ {
+ double d = (*j - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= Ni;
+ double dev = std::sqrt(var);
+ skew /= Ni * dev * var;
+ kurtosis /= Ni * var * var;
+ kurtosis -= 3;
+ double x_mean = (b[i+1] + b[i]) / 2;
+ double x_var = sqr(b[i+1] - b[i]) / 12;
+ double x_skew = 0;
+ double x_kurtosis = -6./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ }
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval_param.pass.cpp
new file mode 100644
index 000000000000..6850115875bb
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval_param.pass.cpp
@@ -0,0 +1,97 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_constant_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
+
+#include <random>
+#include <vector>
+#include <iterator>
+#include <numeric>
+#include <cassert>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x*x;
+}
+
+int main()
+{
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 62.5, 12.5};
+ const size_t Np = sizeof(p) / sizeof(p[0]);
+ D d;
+ P pa(b, b+Np+1, p);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, pa);
+ assert(10 <= v && v < 17);
+ u.push_back(v);
+ }
+ std::vector<double> prob(std::begin(p), std::end(p));
+ double s = std::accumulate(prob.begin(), prob.end(), 0.0);
+ for (int i = 0; i < prob.size(); ++i)
+ prob[i] /= s;
+ std::sort(u.begin(), u.end());
+ for (int i = 0; i < Np; ++i)
+ {
+ typedef std::vector<D::result_type>::iterator I;
+ I lb = std::lower_bound(u.begin(), u.end(), b[i]);
+ I ub = std::lower_bound(u.begin(), u.end(), b[i+1]);
+ const size_t Ni = ub - lb;
+ if (prob[i] == 0)
+ assert(Ni == 0);
+ else
+ {
+ assert(std::abs((double)Ni/N - prob[i]) / prob[i] < .01);
+ double mean = std::accumulate(lb, ub, 0.0) / Ni;
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (I j = lb; j != ub; ++j)
+ {
+ double d = (*j - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= Ni;
+ double dev = std::sqrt(var);
+ skew /= Ni * dev * var;
+ kurtosis /= Ni * var * var;
+ kurtosis -= 3;
+ double x_mean = (b[i+1] + b[i]) / 2;
+ double x_var = sqr(b[i+1] - b[i]) / 12;
+ double x_skew = 0;
+ double x_kurtosis = -6./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ }
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/get_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/get_param.pass.cpp
new file mode 100644
index 000000000000..fdda4e8f0d6b
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/get_param.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_constant_distribution
+
+// param_type param() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ typedef D::param_type P;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 62.5, 12.5};
+ const size_t Np = sizeof(p) / sizeof(p[0]);
+ P pa(b, b+Np+1, p);
+ D d(pa);
+ assert(d.param() == pa);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/io.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/io.pass.cpp
new file mode 100644
index 000000000000..9af776d549a6
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/io.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_constant_distribution
+
+// template <class charT, class traits>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& os,
+// const piecewise_constant_distribution& x);
+//
+// template <class charT, class traits>
+// basic_istream<charT, traits>&
+// operator>>(basic_istream<charT, traits>& is,
+// piecewise_constant_distribution& x);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 62.5, 12.5};
+ const size_t Np = sizeof(p) / sizeof(p[0]);
+ D d1(b, b+Np+1, p);
+ std::ostringstream os;
+ os << d1;
+ std::istringstream is(os.str());
+ D d2;
+ is >> d2;
+ assert(d1 == d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/max.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/max.pass.cpp
new file mode 100644
index 000000000000..772c36ed73e3
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/max.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_constant_distribution
+
+// result_type max() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 62.5, 12.5};
+ const size_t Np = sizeof(p) / sizeof(p[0]);
+ D d(b, b+Np+1, p);
+ assert(d.max() == 17);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/min.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/min.pass.cpp
new file mode 100644
index 000000000000..66618ba95d73
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/min.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_constant_distribution
+
+// result_type min() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 62.5, 12.5};
+ const size_t Np = sizeof(p) / sizeof(p[0]);
+ D d(b, b+Np+1, p);
+ assert(d.min() == 10);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_assign.pass.cpp
new file mode 100644
index 000000000000..4d3a503584ee
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_assign.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_constant_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ typedef D::param_type P;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 62.5, 12.5};
+ const size_t Np = sizeof(p) / sizeof(p[0]);
+ P p0(b, b+Np+1, p);
+ P p1;
+ p1 = p0;
+ assert(p1 == p0);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_copy.pass.cpp
new file mode 100644
index 000000000000..de63a54edfbe
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_copy.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_constant_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ typedef D::param_type P;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 62.5, 12.5};
+ const size_t Np = sizeof(p) / sizeof(p[0]);
+ P p0(b, b+Np+1, p);
+ P p1 = p0;
+ assert(p1 == p0);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_ctor_default.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_ctor_default.pass.cpp
new file mode 100644
index 000000000000..fd84d46713c0
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_ctor_default.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_constant_distribution
+
+// param_type();
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ typedef D::param_type P;
+ P pa;
+ std::vector<double> iv = pa.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 0);
+ assert(iv[1] == 1);
+ std::vector<double> dn = pa.densities();
+ assert(dn.size() == 1);
+ assert(dn[0] == 1);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_ctor_func.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_ctor_func.pass.cpp
new file mode 100644
index 000000000000..98e3006f3e32
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_ctor_func.pass.cpp
@@ -0,0 +1,67 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_constant_distribution
+
+// template<class UnaryOperation>
+// param_type(size_t nw, double xmin, double xmax,
+// UnaryOperation fw);
+
+#include <random>
+#include <cassert>
+
+double fw(double x)
+{
+ return 2*x;
+}
+
+int main()
+{
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ typedef D::param_type P;
+ P pa(0, 0, 1, fw);
+ std::vector<double> iv = pa.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 0);
+ assert(iv[1] == 1);
+ std::vector<double> dn = pa.densities();
+ assert(dn.size() == 1);
+ assert(dn[0] == 1);
+ }
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ typedef D::param_type P;
+ P pa(1, 10, 12, fw);
+ std::vector<double> iv = pa.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 10);
+ assert(iv[1] == 12);
+ std::vector<double> dn = pa.densities();
+ assert(dn.size() == 1);
+ assert(dn[0] == 0.5);
+ }
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ typedef D::param_type P;
+ P pa(2, 6, 14, fw);
+ std::vector<double> iv = pa.intervals();
+ assert(iv.size() == 3);
+ assert(iv[0] == 6);
+ assert(iv[1] == 10);
+ assert(iv[2] == 14);
+ std::vector<double> dn = pa.densities();
+ assert(dn.size() == 2);
+ assert(dn[0] == 0.1);
+ assert(dn[1] == 0.15);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_ctor_init_func.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_ctor_init_func.pass.cpp
new file mode 100644
index 000000000000..fa6530979ed8
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_ctor_init_func.pass.cpp
@@ -0,0 +1,79 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_constant_distribution
+
+// param_type(initializer_list<result_type> bl, UnaryOperation fw);
+
+#include <random>
+#include <cassert>
+
+double f(double x)
+{
+ return x*2;
+}
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ typedef D::param_type P;
+ P pa({}, f);
+ std::vector<double> iv = pa.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 0);
+ assert(iv[1] == 1);
+ std::vector<double> dn = pa.densities();
+ assert(dn.size() == 1);
+ assert(dn[0] == 1);
+ }
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ typedef D::param_type P;
+ P pa({12}, f);
+ std::vector<double> iv = pa.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 0);
+ assert(iv[1] == 1);
+ std::vector<double> dn = pa.densities();
+ assert(dn.size() == 1);
+ assert(dn[0] == 1);
+ }
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ typedef D::param_type P;
+ P pa({12, 14}, f);
+ std::vector<double> iv = pa.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 12);
+ assert(iv[1] == 14);
+ std::vector<double> dn = pa.densities();
+ assert(dn.size() == 1);
+ assert(dn[0] == 0.5);
+ }
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ typedef D::param_type P;
+ P pa({5.5, 7.5, 11.5}, f);
+ std::vector<double> iv = pa.intervals();
+ assert(iv.size() == 3);
+ assert(iv[0] == 5.5);
+ assert(iv[1] == 7.5);
+ assert(iv[2] == 11.5);
+ std::vector<double> dn = pa.densities();
+ assert(dn.size() == 2);
+ assert(dn[0] == 0.203125);
+ assert(dn[1] == 0.1484375);
+ }
+#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_ctor_iterator.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_ctor_iterator.pass.cpp
new file mode 100644
index 000000000000..98d467c07e23
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_ctor_iterator.pass.cpp
@@ -0,0 +1,100 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_constant_distribution
+
+// template<class InputIterator>
+// param_type(InputIteratorB firstB, InputIteratorB lastB,
+// InputIteratorW firstW);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ typedef D::param_type P;
+ double b[] = {10};
+ double p[] = {12};
+ P pa(b, b, p);
+ std::vector<double> iv = pa.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 0);
+ assert(iv[1] == 1);
+ std::vector<double> dn = pa.densities();
+ assert(dn.size() == 1);
+ assert(dn[0] == 1);
+ }
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ typedef D::param_type P;
+ double b[] = {10};
+ double p[] = {12};
+ P pa(b, b+1, p);
+ std::vector<double> iv = pa.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 0);
+ assert(iv[1] == 1);
+ std::vector<double> dn = pa.densities();
+ assert(dn.size() == 1);
+ assert(dn[0] == 1);
+ }
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ typedef D::param_type P;
+ double b[] = {10, 15};
+ double p[] = {12};
+ P pa(b, b+2, p);
+ std::vector<double> iv = pa.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 10);
+ assert(iv[1] == 15);
+ std::vector<double> dn = pa.densities();
+ assert(dn.size() == 1);
+ assert(dn[0] == 1/5.);
+ }
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ typedef D::param_type P;
+ double b[] = {10, 15, 16};
+ double p[] = {.25, .75};
+ P pa(b, b+3, p);
+ std::vector<double> iv = pa.intervals();
+ assert(iv.size() == 3);
+ assert(iv[0] == 10);
+ assert(iv[1] == 15);
+ assert(iv[2] == 16);
+ std::vector<double> dn = pa.densities();
+ assert(dn.size() == 2);
+ assert(dn[0] == .25/5.);
+ assert(dn[1] == .75);
+ }
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ typedef D::param_type P;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 62.5, 12.5};
+ P pa(b, b+4, p);
+ std::vector<double> iv = pa.intervals();
+ assert(iv.size() == 4);
+ assert(iv[0] == 10);
+ assert(iv[1] == 14);
+ assert(iv[2] == 16);
+ assert(iv[3] == 17);
+ std::vector<double> dn = pa.densities();
+ assert(dn.size() == 3);
+ assert(dn[0] == .0625);
+ assert(dn[1] == .3125);
+ assert(dn[2] == .125);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_eq.pass.cpp
new file mode 100644
index 000000000000..9cc554e604af
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_eq.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_constant_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ typedef D::param_type P;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 62.5, 12.5};
+ P p1(b, b+4, p);
+ P p2(b, b+4, p);
+ assert(p1 == p2);
+ }
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ typedef D::param_type P;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 62.5, 12.5};
+ P p1(b, b+3, p);
+ P p2(b, b+4, p);
+ assert(p1 != p2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_types.pass.cpp
new file mode 100644
index 000000000000..e039df36c98a
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_types.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_constant_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ typedef D::param_type param_type;
+ typedef param_type::distribution_type distribution_type;
+ static_assert((std::is_same<D, distribution_type>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/set_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/set_param.pass.cpp
new file mode 100644
index 000000000000..1a3fedb0940f
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/set_param.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_constant_distribution
+
+// void param(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ typedef D::param_type P;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 62.5, 12.5};
+ P pa(b, b+4, p);
+ D d;
+ d.param(pa);
+ assert(d.param() == pa);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/types.pass.cpp
new file mode 100644
index 000000000000..760325979738
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/types.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_constant_distribution
+// {
+// typedef bool result_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::piecewise_constant_distribution<> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, double>::value), "");
+ }
+ {
+ typedef std::piecewise_constant_distribution<float> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, float>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/assign.pass.cpp
new file mode 100644
index 000000000000..0ba7dcb59198
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/assign.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_linear_distribution
+
+// piecewise_linear_distribution& operator=(const piecewise_linear_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::piecewise_linear_distribution<> D;
+ double p[] = {2, 4, 1, 8, 3};
+ double b[] = {2, 4, 5, 8, 9};
+ D d1(b, b+5, p);
+ D d2;
+ assert(d1 != d2);
+ d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/copy.pass.cpp
new file mode 100644
index 000000000000..536b139dda61
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/copy.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_linear_distribution
+
+// piecewise_linear_distribution(const piecewise_linear_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::piecewise_linear_distribution<> D;
+ double p[] = {2, 4, 1, 8, 2};
+ double b[] = {2, 4, 5, 8, 9};
+ D d1(b, b+5, p);
+ D d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_default.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_default.pass.cpp
new file mode 100644
index 000000000000..745bd6b97ec8
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_default.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_linear_distribution
+
+// piecewise_linear_distribution(initializer_list<double> wl);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ D d;
+ std::vector<double> iv = d.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 0);
+ assert(iv[1] == 1);
+ std::vector<double> dn = d.densities();
+ assert(dn.size() == 2);
+ assert(dn[0] == 1);
+ assert(dn[1] == 1);
+ }
+#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_func.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_func.pass.cpp
new file mode 100644
index 000000000000..3ebaf77f7564
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_func.pass.cpp
@@ -0,0 +1,69 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_linear_distribution
+
+// template<class UnaryOperation>
+// piecewise_linear_distribution(size_t nw, result_type xmin,
+// result_type xmax, UnaryOperation fw);
+
+#include <iostream>
+
+#include <random>
+#include <cassert>
+
+double fw(double x)
+{
+ return 2*x;
+}
+
+int main()
+{
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ D d(0, 0, 1, fw);
+ std::vector<double> iv = d.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 0);
+ assert(iv[1] == 1);
+ std::vector<double> dn = d.densities();
+ assert(dn.size() == 2);
+ assert(dn[0] == 0);
+ assert(dn[1] == 2);
+ }
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ D d(1, 10, 12, fw);
+ std::vector<double> iv = d.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 10);
+ assert(iv[1] == 12);
+ std::vector<double> dn = d.densities();
+ assert(dn.size() == 2);
+ assert(dn[0] == 20./44);
+ assert(dn[1] == 24./44);
+ }
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ D d(2, 6, 14, fw);
+ std::vector<double> iv = d.intervals();
+ assert(iv.size() == 3);
+ assert(iv[0] == 6);
+ assert(iv[1] == 10);
+ assert(iv[2] == 14);
+ std::vector<double> dn = d.densities();
+ assert(dn.size() == 3);
+ assert(dn[0] == 0.075);
+ assert(dn[1] == 0.125);
+ assert(dn[2] == 0.175);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_init_func.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_init_func.pass.cpp
new file mode 100644
index 000000000000..44c76f0cf6cb
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_init_func.pass.cpp
@@ -0,0 +1,82 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_linear_distribution
+
+// piecewise_linear_distribution(initializer_list<result_type> bl,
+// UnaryOperation fw);
+
+#include <iostream>
+
+#include <random>
+#include <cassert>
+
+double f(double x)
+{
+ return x*2;
+}
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ D d({}, f);
+ std::vector<double> iv = d.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 0);
+ assert(iv[1] == 1);
+ std::vector<double> dn = d.densities();
+ assert(dn.size() == 2);
+ assert(dn[0] == 1);
+ assert(dn[1] == 1);
+ }
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ D d({12}, f);
+ std::vector<double> iv = d.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 0);
+ assert(iv[1] == 1);
+ std::vector<double> dn = d.densities();
+ assert(dn.size() == 2);
+ assert(dn[0] == 1);
+ assert(dn[1] == 1);
+ }
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ D d({10, 12}, f);
+ std::vector<double> iv = d.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 10);
+ assert(iv[1] == 12);
+ std::vector<double> dn = d.densities();
+ assert(dn.size() == 2);
+ assert(dn[0] == 20./44);
+ assert(dn[1] == 24./44);
+ }
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ D d({6, 10, 14}, f);
+ std::vector<double> iv = d.intervals();
+ assert(iv.size() == 3);
+ assert(iv[0] == 6);
+ assert(iv[1] == 10);
+ assert(iv[2] == 14);
+ std::vector<double> dn = d.densities();
+ assert(dn.size() == 3);
+ assert(dn[0] == 0.075);
+ assert(dn[1] == 0.125);
+ assert(dn[2] == 0.175);
+ }
+#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_iterator.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_iterator.pass.cpp
new file mode 100644
index 000000000000..5fce58bbd978
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_iterator.pass.cpp
@@ -0,0 +1,101 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_linear_distribution
+
+// template<class InputIterator>
+// piecewise_linear_distribution(InputIteratorB firstB,
+// InputIteratorB lastB,
+// InputIteratorW firstW);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ double b[] = {10};
+ double p[] = {12};
+ D d(b, b, p);
+ std::vector<double> iv = d.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 0);
+ assert(iv[1] == 1);
+ std::vector<double> dn = d.densities();
+ assert(dn.size() == 2);
+ assert(dn[0] == 1);
+ assert(dn[1] == 1);
+ }
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ double b[] = {10};
+ double p[] = {12};
+ D d(b, b+1, p);
+ std::vector<double> iv = d.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 0);
+ assert(iv[1] == 1);
+ std::vector<double> dn = d.densities();
+ assert(dn.size() == 2);
+ assert(dn[0] == 1);
+ assert(dn[1] == 1);
+ }
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ double b[] = {10, 15};
+ double p[] = {20, 20};
+ D d(b, b+2, p);
+ std::vector<double> iv = d.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 10);
+ assert(iv[1] == 15);
+ std::vector<double> dn = d.densities();
+ assert(dn.size() == 2);
+ assert(dn[0] == 1/5.);
+ assert(dn[1] == 1/5.);
+ }
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ double b[] = {10, 15, 16};
+ double p[] = {.25, .75, .25};
+ D d(b, b+3, p);
+ std::vector<double> iv = d.intervals();
+ assert(iv.size() == 3);
+ assert(iv[0] == 10);
+ assert(iv[1] == 15);
+ assert(iv[2] == 16);
+ std::vector<double> dn = d.densities();
+ assert(dn.size() == 3);
+ assert(dn[0] == .25/3);
+ assert(dn[1] == .75/3);
+ assert(dn[2] == .25/3);
+ }
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {0, 1, 1, 0};
+ D d(b, b+4, p);
+ std::vector<double> iv = d.intervals();
+ assert(iv.size() == 4);
+ assert(iv[0] == 10);
+ assert(iv[1] == 14);
+ assert(iv[2] == 16);
+ assert(iv[3] == 17);
+ std::vector<double> dn = d.densities();
+ assert(dn.size() == 4);
+ assert(dn[0] == 0);
+ assert(dn[1] == 1/4.5);
+ assert(dn[2] == 1/4.5);
+ assert(dn[3] == 0);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_param.pass.cpp
new file mode 100644
index 000000000000..7dc47b4a3a2e
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_param.pass.cpp
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_linear_distribution
+
+// explicit piecewise_linear_distribution(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ typedef D::param_type P;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 62.5, 12.5, 0};
+ P pa(b, b+4, p);
+ D d(pa);
+ std::vector<double> iv = d.intervals();
+ assert(iv.size() == 4);
+ assert(iv[0] == 10);
+ assert(iv[1] == 14);
+ assert(iv[2] == 16);
+ assert(iv[3] == 17);
+ std::vector<double> dn = d.densities();
+ assert(dn.size() == 4);
+ assert(dn[0] == 25/256.25);
+ assert(dn[1] == 62.5/256.25);
+ assert(dn[2] == 12.5/256.25);
+ assert(dn[3] == 0);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eq.pass.cpp
new file mode 100644
index 000000000000..766989c58899
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eq.pass.cpp
@@ -0,0 +1,47 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_linear_distribution
+
+// bool operator=(const piecewise_linear_distribution& x,
+// const piecewise_linear_distribution& y);
+// bool operator!(const piecewise_linear_distribution& x,
+// const piecewise_linear_distribution& y);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ D d1;
+ D d2;
+ assert(d1 == d2);
+ }
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 62.5, 12.5, 1};
+ D d1(b, b+4, p);
+ D d2(b, b+4, p);
+ assert(d1 == d2);
+ }
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 62.5, 12.5, 0};
+ D d1(b, b+4, p);
+ D d2;
+ assert(d1 != d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp
new file mode 100644
index 000000000000..af75fce512e4
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp
@@ -0,0 +1,343 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_linear_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g);
+
+#include <iostream>
+
+#include <random>
+#include <vector>
+#include <iterator>
+#include <numeric>
+#include <cassert>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x*x;
+}
+
+double
+f(double x, double a, double m, double b, double c)
+{
+ return a + m*(sqr(x) - sqr(b))/2 + c*(x-b);
+}
+
+int main()
+{
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {0, 1, 1, 0};
+ const size_t Np = sizeof(p) / sizeof(p[0]) - 1;
+ D d(b, b+Np+1, p);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v < d.max());
+ u.push_back(v);
+ }
+ std::sort(u.begin(), u.end());
+ int kp = -1;
+ double a;
+ double m;
+ double bk;
+ double c;
+ std::vector<double> areas(Np);
+ double S = 0;
+ for (int i = 0; i < areas.size(); ++i)
+ {
+ areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2;
+ S += areas[i];
+ }
+ for (int i = 0; i < areas.size(); ++i)
+ areas[i] /= S;
+ for (int i = 0; i < Np+1; ++i)
+ p[i] /= S;
+ for (int i = 0; i < N; ++i)
+ {
+ int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
+ if (k != kp)
+ {
+ a = 0;
+ for (int j = 0; j < k; ++j)
+ a += areas[j];
+ m = (p[k+1] - p[k]) / (b[k+1] - b[k]);
+ bk = b[k];
+ c = (b[k+1]*p[k] - b[k]*p[k+1]) / (b[k+1] - b[k]);
+ kp = k;
+ }
+ assert(std::abs(f(u[i], a, m, bk, c) - double(i)/N) < .001);
+ }
+ }
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {0, 0, 1, 0};
+ const size_t Np = sizeof(p) / sizeof(p[0]) - 1;
+ D d(b, b+Np+1, p);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v < d.max());
+ u.push_back(v);
+ }
+ std::sort(u.begin(), u.end());
+ int kp = -1;
+ double a;
+ double m;
+ double bk;
+ double c;
+ std::vector<double> areas(Np);
+ double S = 0;
+ for (int i = 0; i < areas.size(); ++i)
+ {
+ areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2;
+ S += areas[i];
+ }
+ for (int i = 0; i < areas.size(); ++i)
+ areas[i] /= S;
+ for (int i = 0; i < Np+1; ++i)
+ p[i] /= S;
+ for (int i = 0; i < N; ++i)
+ {
+ int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
+ if (k != kp)
+ {
+ a = 0;
+ for (int j = 0; j < k; ++j)
+ a += areas[j];
+ m = (p[k+1] - p[k]) / (b[k+1] - b[k]);
+ bk = b[k];
+ c = (b[k+1]*p[k] - b[k]*p[k+1]) / (b[k+1] - b[k]);
+ kp = k;
+ }
+ assert(std::abs(f(u[i], a, m, bk, c) - double(i)/N) < .001);
+ }
+ }
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {1, 0, 0, 0};
+ const size_t Np = sizeof(p) / sizeof(p[0]) - 1;
+ D d(b, b+Np+1, p);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v < d.max());
+ u.push_back(v);
+ }
+ std::sort(u.begin(), u.end());
+ int kp = -1;
+ double a;
+ double m;
+ double bk;
+ double c;
+ std::vector<double> areas(Np);
+ double S = 0;
+ for (int i = 0; i < areas.size(); ++i)
+ {
+ areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2;
+ S += areas[i];
+ }
+ for (int i = 0; i < areas.size(); ++i)
+ areas[i] /= S;
+ for (int i = 0; i < Np+1; ++i)
+ p[i] /= S;
+ for (int i = 0; i < N; ++i)
+ {
+ int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
+ if (k != kp)
+ {
+ a = 0;
+ for (int j = 0; j < k; ++j)
+ a += areas[j];
+ m = (p[k+1] - p[k]) / (b[k+1] - b[k]);
+ bk = b[k];
+ c = (b[k+1]*p[k] - b[k]*p[k+1]) / (b[k+1] - b[k]);
+ kp = k;
+ }
+ assert(std::abs(f(u[i], a, m, bk, c) - double(i)/N) < .001);
+ }
+ }
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14, 16};
+ double p[] = {0, 1, 0};
+ const size_t Np = sizeof(p) / sizeof(p[0]) - 1;
+ D d(b, b+Np+1, p);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v < d.max());
+ u.push_back(v);
+ }
+ std::sort(u.begin(), u.end());
+ int kp = -1;
+ double a;
+ double m;
+ double bk;
+ double c;
+ std::vector<double> areas(Np);
+ double S = 0;
+ for (int i = 0; i < areas.size(); ++i)
+ {
+ areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2;
+ S += areas[i];
+ }
+ for (int i = 0; i < areas.size(); ++i)
+ areas[i] /= S;
+ for (int i = 0; i < Np+1; ++i)
+ p[i] /= S;
+ for (int i = 0; i < N; ++i)
+ {
+ int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
+ if (k != kp)
+ {
+ a = 0;
+ for (int j = 0; j < k; ++j)
+ a += areas[j];
+ m = (p[k+1] - p[k]) / (b[k+1] - b[k]);
+ bk = b[k];
+ c = (b[k+1]*p[k] - b[k]*p[k+1]) / (b[k+1] - b[k]);
+ kp = k;
+ }
+ assert(std::abs(f(u[i], a, m, bk, c) - double(i)/N) < .001);
+ }
+ }
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14};
+ double p[] = {1, 1};
+ const size_t Np = sizeof(p) / sizeof(p[0]) - 1;
+ D d(b, b+Np+1, p);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v < d.max());
+ u.push_back(v);
+ }
+ std::sort(u.begin(), u.end());
+ int kp = -1;
+ double a;
+ double m;
+ double bk;
+ double c;
+ std::vector<double> areas(Np);
+ double S = 0;
+ for (int i = 0; i < areas.size(); ++i)
+ {
+ areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2;
+ S += areas[i];
+ }
+ for (int i = 0; i < areas.size(); ++i)
+ areas[i] /= S;
+ for (int i = 0; i < Np+1; ++i)
+ p[i] /= S;
+ for (int i = 0; i < N; ++i)
+ {
+ int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
+ if (k != kp)
+ {
+ a = 0;
+ for (int j = 0; j < k; ++j)
+ a += areas[j];
+ m = (p[k+1] - p[k]) / (b[k+1] - b[k]);
+ bk = b[k];
+ c = (b[k+1]*p[k] - b[k]*p[k+1]) / (b[k+1] - b[k]);
+ kp = k;
+ }
+ assert(std::abs(f(u[i], a, m, bk, c) - double(i)/N) < .001);
+ }
+ }
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 62.5, 12.5, 0};
+ const size_t Np = sizeof(p) / sizeof(p[0]) - 1;
+ D d(b, b+Np+1, p);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.min() <= v && v < d.max());
+ u.push_back(v);
+ }
+ std::sort(u.begin(), u.end());
+ int kp = -1;
+ double a;
+ double m;
+ double bk;
+ double c;
+ std::vector<double> areas(Np);
+ double S = 0;
+ for (int i = 0; i < areas.size(); ++i)
+ {
+ areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2;
+ S += areas[i];
+ }
+ for (int i = 0; i < areas.size(); ++i)
+ areas[i] /= S;
+ for (int i = 0; i < Np+1; ++i)
+ p[i] /= S;
+ for (int i = 0; i < N; ++i)
+ {
+ int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
+ if (k != kp)
+ {
+ a = 0;
+ for (int j = 0; j < k; ++j)
+ a += areas[j];
+ m = (p[k+1] - p[k]) / (b[k+1] - b[k]);
+ bk = b[k];
+ c = (b[k+1]*p[k] - b[k]*p[k+1]) / (b[k+1] - b[k]);
+ kp = k;
+ }
+ assert(std::abs(f(u[i], a, m, bk, c) - double(i)/N) < .001);
+ }
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp
new file mode 100644
index 000000000000..fe704228e788
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp
@@ -0,0 +1,92 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_linear_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
+
+#include <random>
+#include <vector>
+#include <iterator>
+#include <numeric>
+#include <cassert>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x*x;
+}
+
+double
+f(double x, double a, double m, double b, double c)
+{
+ return a + m*(sqr(x) - sqr(b))/2 + c*(x-b);
+}
+
+int main()
+{
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ typedef D::param_type P;
+ typedef std::mt19937_64 G;
+ G g;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 62.5, 12.5, 0};
+ const size_t Np = sizeof(p) / sizeof(p[0]) - 1;
+ D d;
+ P pa(b, b+Np+1, p);
+ const int N = 1000000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, pa);
+ assert(10 <= v && v < 17);
+ u.push_back(v);
+ }
+ std::sort(u.begin(), u.end());
+ int kp = -1;
+ double a;
+ double m;
+ double bk;
+ double c;
+ std::vector<double> areas(Np);
+ double S = 0;
+ for (int i = 0; i < areas.size(); ++i)
+ {
+ areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2;
+ S += areas[i];
+ }
+ for (int i = 0; i < areas.size(); ++i)
+ areas[i] /= S;
+ for (int i = 0; i < Np+1; ++i)
+ p[i] /= S;
+ for (int i = 0; i < N; ++i)
+ {
+ int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
+ if (k != kp)
+ {
+ a = 0;
+ for (int j = 0; j < k; ++j)
+ a += areas[j];
+ m = (p[k+1] - p[k]) / (b[k+1] - b[k]);
+ bk = b[k];
+ c = (b[k+1]*p[k] - b[k]*p[k+1]) / (b[k+1] - b[k]);
+ kp = k;
+ }
+ assert(std::abs(f(u[i], a, m, bk, c) - double(i)/N) < .001);
+ }
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/get_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/get_param.pass.cpp
new file mode 100644
index 000000000000..57a8ca5589c3
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/get_param.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_linear_distribution
+
+// param_type param() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ typedef D::param_type P;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 62.5, 12.5, 10};
+ const size_t Np = sizeof(p) / sizeof(p[0]);
+ P pa(b, b+Np, p);
+ D d(pa);
+ assert(d.param() == pa);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/io.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/io.pass.cpp
new file mode 100644
index 000000000000..1be2791fa47a
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/io.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_linear_distribution
+
+// template <class charT, class traits>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& os,
+// const piecewise_linear_distribution& x);
+//
+// template <class charT, class traits>
+// basic_istream<charT, traits>&
+// operator>>(basic_istream<charT, traits>& is,
+// piecewise_linear_distribution& x);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 62.5, 12.5, 25};
+ const size_t Np = sizeof(p) / sizeof(p[0]);
+ D d1(b, b+Np, p);
+ std::ostringstream os;
+ os << d1;
+ std::istringstream is(os.str());
+ D d2;
+ is >> d2;
+ assert(d1 == d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/max.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/max.pass.cpp
new file mode 100644
index 000000000000..3dc12b692535
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/max.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_linear_distribution
+
+// result_type max() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 62.5, 12.5, 5};
+ const size_t Np = sizeof(p) / sizeof(p[0]);
+ D d(b, b+Np, p);
+ assert(d.max() == 17);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/min.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/min.pass.cpp
new file mode 100644
index 000000000000..4d4a7603a018
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/min.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_linear_distribution
+
+// result_type min() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 62.5, 12.5, 0};
+ const size_t Np = sizeof(p) / sizeof(p[0]);
+ D d(b, b+Np, p);
+ assert(d.min() == 10);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_assign.pass.cpp
new file mode 100644
index 000000000000..055b2f58e792
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_assign.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_linear_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ typedef D::param_type P;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 62.5, 12.5, 2};
+ const size_t Np = sizeof(p) / sizeof(p[0]);
+ P p0(b, b+Np, p);
+ P p1;
+ p1 = p0;
+ assert(p1 == p0);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_copy.pass.cpp
new file mode 100644
index 000000000000..87d94940a870
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_copy.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_linear_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ typedef D::param_type P;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 62.5, 12.5, 5};
+ const size_t Np = sizeof(p) / sizeof(p[0]);
+ P p0(b, b+Np, p);
+ P p1 = p0;
+ assert(p1 == p0);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_ctor_default.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_ctor_default.pass.cpp
new file mode 100644
index 000000000000..0bdf2c337d27
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_ctor_default.pass.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_linear_distribution
+
+// param_type();
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ typedef D::param_type P;
+ P pa;
+ std::vector<double> iv = pa.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 0);
+ assert(iv[1] == 1);
+ std::vector<double> dn = pa.densities();
+ assert(dn.size() == 2);
+ assert(dn[0] == 1);
+ assert(dn[1] == 1);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_ctor_func.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_ctor_func.pass.cpp
new file mode 100644
index 000000000000..27e93ab6171b
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_ctor_func.pass.cpp
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_linear_distribution
+
+// template<class UnaryOperation>
+// param_type(size_t nw, double xmin, double xmax,
+// UnaryOperation fw);
+
+#include <random>
+#include <cassert>
+
+double fw(double x)
+{
+ return 2*x;
+}
+
+int main()
+{
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ typedef D::param_type P;
+ P pa(0, 0, 1, fw);
+ std::vector<double> iv = pa.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 0);
+ assert(iv[1] == 1);
+ std::vector<double> dn = pa.densities();
+ assert(dn.size() == 2);
+ assert(dn[0] == 0);
+ assert(dn[1] == 2);
+ }
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ typedef D::param_type P;
+ P pa(1, 10, 12, fw);
+ std::vector<double> iv = pa.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 10);
+ assert(iv[1] == 12);
+ std::vector<double> dn = pa.densities();
+ assert(dn.size() == 2);
+ assert(dn[0] == 20./44);
+ assert(dn[1] == 24./44);
+ }
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ typedef D::param_type P;
+ P pa(2, 6, 14, fw);
+ std::vector<double> iv = pa.intervals();
+ assert(iv.size() == 3);
+ assert(iv[0] == 6);
+ assert(iv[1] == 10);
+ assert(iv[2] == 14);
+ std::vector<double> dn = pa.densities();
+ assert(dn.size() == 3);
+ assert(dn[0] == 0.075);
+ assert(dn[1] == 0.125);
+ assert(dn[2] == 0.175);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_ctor_init_func.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_ctor_init_func.pass.cpp
new file mode 100644
index 000000000000..cfa416434a29
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_ctor_init_func.pass.cpp
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_linear_distribution
+
+// param_type(initializer_list<result_type> bl, UnaryOperation fw);
+
+#include <random>
+#include <cassert>
+
+double f(double x)
+{
+ return x*2;
+}
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ typedef D::param_type P;
+ P pa({}, f);
+ std::vector<double> iv = pa.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 0);
+ assert(iv[1] == 1);
+ std::vector<double> dn = pa.densities();
+ assert(dn.size() == 2);
+ assert(dn[0] == 1);
+ assert(dn[1] == 1);
+ }
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ typedef D::param_type P;
+ P pa({12}, f);
+ std::vector<double> iv = pa.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 0);
+ assert(iv[1] == 1);
+ std::vector<double> dn = pa.densities();
+ assert(dn.size() == 2);
+ assert(dn[0] == 1);
+ assert(dn[1] == 1);
+ }
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ typedef D::param_type P;
+ P pa({10, 12}, f);
+ std::vector<double> iv = pa.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 10);
+ assert(iv[1] == 12);
+ std::vector<double> dn = pa.densities();
+ assert(dn.size() == 2);
+ assert(dn[0] == 20./44);
+ assert(dn[1] == 24./44);
+ }
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ typedef D::param_type P;
+ P pa({6, 10, 14}, f);
+ std::vector<double> iv = pa.intervals();
+ assert(iv.size() == 3);
+ assert(iv[0] == 6);
+ assert(iv[1] == 10);
+ assert(iv[2] == 14);
+ std::vector<double> dn = pa.densities();
+ assert(dn.size() == 3);
+ assert(dn[0] == 0.075);
+ assert(dn[1] == 0.125);
+ assert(dn[2] == 0.175);
+ }
+#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_ctor_iterator.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_ctor_iterator.pass.cpp
new file mode 100644
index 000000000000..117a5ef93bb0
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_ctor_iterator.pass.cpp
@@ -0,0 +1,105 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_linear_distribution
+
+// template<class InputIterator>
+// param_type(InputIteratorB firstB, InputIteratorB lastB,
+// InputIteratorW firstW);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ typedef D::param_type P;
+ double b[] = {10};
+ double p[] = {12};
+ P pa(b, b, p);
+ std::vector<double> iv = pa.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 0);
+ assert(iv[1] == 1);
+ std::vector<double> dn = pa.densities();
+ assert(dn.size() == 2);
+ assert(dn[0] == 1);
+ assert(dn[1] == 1);
+ }
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ typedef D::param_type P;
+ double b[] = {10};
+ double p[] = {12};
+ P pa(b, b+1, p);
+ std::vector<double> iv = pa.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 0);
+ assert(iv[1] == 1);
+ std::vector<double> dn = pa.densities();
+ assert(dn.size() == 2);
+ assert(dn[0] == 1);
+ assert(dn[1] == 1);
+ }
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ typedef D::param_type P;
+ double b[] = {10, 15};
+ double p[] = {12, 12};
+ P pa(b, b+2, p);
+ std::vector<double> iv = pa.intervals();
+ assert(iv.size() == 2);
+ assert(iv[0] == 10);
+ assert(iv[1] == 15);
+ std::vector<double> dn = pa.densities();
+ assert(dn.size() == 2);
+ assert(dn[0] == 1/5.);
+ assert(dn[1] == 1/5.);
+ }
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ typedef D::param_type P;
+ double b[] = {10, 15, 16};
+ double p[] = {.25, .75, .25};
+ P pa(b, b+3, p);
+ std::vector<double> iv = pa.intervals();
+ assert(iv.size() == 3);
+ assert(iv[0] == 10);
+ assert(iv[1] == 15);
+ assert(iv[2] == 16);
+ std::vector<double> dn = pa.densities();
+ assert(dn.size() == 3);
+ assert(dn[0] == .25/3);
+ assert(dn[1] == .75/3);
+ assert(dn[2] == .25/3);
+ }
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ typedef D::param_type P;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {0, 1, 1, 0};
+ P pa(b, b+4, p);
+ std::vector<double> iv = pa.intervals();
+ assert(iv.size() == 4);
+ assert(iv[0] == 10);
+ assert(iv[1] == 14);
+ assert(iv[2] == 16);
+ assert(iv[3] == 17);
+ std::vector<double> dn = pa.densities();
+ assert(dn.size() == 4);
+ assert(dn[0] == 0);
+ assert(dn[1] == 1/4.5);
+ assert(dn[2] == 1/4.5);
+ assert(dn[3] == 0);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_eq.pass.cpp
new file mode 100644
index 000000000000..1adffc8ca868
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_eq.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_linear_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ typedef D::param_type P;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 62.5, 12.5, 0};
+ P p1(b, b+4, p);
+ P p2(b, b+4, p);
+ assert(p1 == p2);
+ }
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ typedef D::param_type P;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 62.5, 12.5, 0};
+ P p1(b, b+3, p);
+ P p2(b, b+4, p);
+ assert(p1 != p2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_types.pass.cpp
new file mode 100644
index 000000000000..cea1e3dffd31
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_types.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_linear_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ typedef D::param_type param_type;
+ typedef param_type::distribution_type distribution_type;
+ static_assert((std::is_same<D, distribution_type>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/set_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/set_param.pass.cpp
new file mode 100644
index 000000000000..e85a2f0ce4c2
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/set_param.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_linear_distribution
+
+// void param(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ typedef D::param_type P;
+ double b[] = {10, 14, 16, 17};
+ double p[] = {25, 62.5, 12.5, 0};
+ P pa(b, b+4, p);
+ D d;
+ d.param(pa);
+ assert(d.param() == pa);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/types.pass.cpp
new file mode 100644
index 000000000000..a34212987878
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/types.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class piecewise_linear_distribution
+// {
+// typedef bool result_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::piecewise_linear_distribution<> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, double>::value), "");
+ }
+ {
+ typedef std::piecewise_linear_distribution<float> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, float>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/nothing_to_do.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..b58f5c55b643
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/assign.pass.cpp
new file mode 100644
index 000000000000..0e04ea455e7e
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/assign.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class _IntType = int>
+// class uniform_int_distribution
+
+// uniform_int_distribution& operator=(const uniform_int_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::uniform_int_distribution<long> D;
+ D d1(2, 5);
+ D d2;
+ assert(d1 != d2);
+ d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/copy.pass.cpp
new file mode 100644
index 000000000000..c09830c6277a
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/copy.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class _IntType = int>
+// class uniform_int_distribution
+
+// uniform_int_distribution(const uniform_int_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::uniform_int_distribution<long> D;
+ D d1(2, 5);
+ D d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/ctor_int_int.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/ctor_int_int.pass.cpp
new file mode 100644
index 000000000000..68f2ec0975a9
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/ctor_int_int.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class _IntType = int>
+// class uniform_int_distribution
+
+// explicit uniform_int_distribution(IntType a = 0,
+// IntType b = numeric_limits<IntType>::max());
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::uniform_int_distribution<> D;
+ D d;
+ assert(d.a() == 0);
+ assert(d.b() == std::numeric_limits<int>::max());
+ }
+ {
+ typedef std::uniform_int_distribution<> D;
+ D d(-6);
+ assert(d.a() == -6);
+ assert(d.b() == std::numeric_limits<int>::max());
+ }
+ {
+ typedef std::uniform_int_distribution<> D;
+ D d(-6, 106);
+ assert(d.a() == -6);
+ assert(d.b() == 106);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/ctor_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/ctor_param.pass.cpp
new file mode 100644
index 000000000000..cc3e86a42bd6
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/ctor_param.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class _IntType = int>
+// class uniform_int_distribution
+
+// explicit uniform_int_distribution(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::uniform_int_distribution<> D;
+ typedef D::param_type P;
+ P p(3, 8);
+ D d(p);
+ assert(d.a() == 3);
+ assert(d.b() == 8);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eq.pass.cpp
new file mode 100644
index 000000000000..b7a5cffbe564
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eq.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class _IntType = int>
+// class uniform_int_distribution
+
+// bool operator=(const uniform_int_distribution& x,
+// const uniform_int_distribution& y);
+// bool operator!(const uniform_int_distribution& x,
+// const uniform_int_distribution& y);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::uniform_int_distribution<> D;
+ D d1(3, 8);
+ D d2(3, 8);
+ assert(d1 == d2);
+ }
+ {
+ typedef std::uniform_int_distribution<> D;
+ D d1(3, 8);
+ D d2(3, 9);
+ assert(d1 != d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eval.pass.cpp
new file mode 100644
index 000000000000..66693a8da55b
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eval.pass.cpp
@@ -0,0 +1,455 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class _IntType = int>
+// class uniform_int_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g);
+
+#include <random>
+#include <cassert>
+#include <vector>
+#include <numeric>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x * x;
+}
+
+int main()
+{
+ {
+ typedef std::uniform_int_distribution<> D;
+ typedef std::minstd_rand0 G;
+ G g;
+ D d;
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.a() <= v && v <= d.b());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = ((double)d.a() + d.b()) / 2;
+ double x_var = (sqr((double)d.b() - d.a() + 1) - 1) / 12;
+ double x_skew = 0;
+ double x_kurtosis = -6. * (sqr((double)d.b() - d.a() + 1) + 1) /
+ (5. * (sqr((double)d.b() - d.a() + 1) - 1));
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::uniform_int_distribution<> D;
+ typedef std::minstd_rand G;
+ G g;
+ D d;
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.a() <= v && v <= d.b());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = ((double)d.a() + d.b()) / 2;
+ double x_var = (sqr((double)d.b() - d.a() + 1) - 1) / 12;
+ double x_skew = 0;
+ double x_kurtosis = -6. * (sqr((double)d.b() - d.a() + 1) + 1) /
+ (5. * (sqr((double)d.b() - d.a() + 1) - 1));
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::uniform_int_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d;
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.a() <= v && v <= d.b());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = ((double)d.a() + d.b()) / 2;
+ double x_var = (sqr((double)d.b() - d.a() + 1) - 1) / 12;
+ double x_skew = 0;
+ double x_kurtosis = -6. * (sqr((double)d.b() - d.a() + 1) + 1) /
+ (5. * (sqr((double)d.b() - d.a() + 1) - 1));
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::uniform_int_distribution<> D;
+ typedef std::mt19937_64 G;
+ G g;
+ D d;
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.a() <= v && v <= d.b());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = ((double)d.a() + d.b()) / 2;
+ double x_var = (sqr((double)d.b() - d.a() + 1) - 1) / 12;
+ double x_skew = 0;
+ double x_kurtosis = -6. * (sqr((double)d.b() - d.a() + 1) + 1) /
+ (5. * (sqr((double)d.b() - d.a() + 1) - 1));
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::uniform_int_distribution<> D;
+ typedef std::ranlux24_base G;
+ G g;
+ D d;
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.a() <= v && v <= d.b());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = ((double)d.a() + d.b()) / 2;
+ double x_var = (sqr((double)d.b() - d.a() + 1) - 1) / 12;
+ double x_skew = 0;
+ double x_kurtosis = -6. * (sqr((double)d.b() - d.a() + 1) + 1) /
+ (5. * (sqr((double)d.b() - d.a() + 1) - 1));
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::uniform_int_distribution<> D;
+ typedef std::ranlux48_base G;
+ G g;
+ D d;
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.a() <= v && v <= d.b());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = ((double)d.a() + d.b()) / 2;
+ double x_var = (sqr((double)d.b() - d.a() + 1) - 1) / 12;
+ double x_skew = 0;
+ double x_kurtosis = -6. * (sqr((double)d.b() - d.a() + 1) + 1) /
+ (5. * (sqr((double)d.b() - d.a() + 1) - 1));
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::uniform_int_distribution<> D;
+ typedef std::ranlux24 G;
+ G g;
+ D d;
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.a() <= v && v <= d.b());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = ((double)d.a() + d.b()) / 2;
+ double x_var = (sqr((double)d.b() - d.a() + 1) - 1) / 12;
+ double x_skew = 0;
+ double x_kurtosis = -6. * (sqr((double)d.b() - d.a() + 1) + 1) /
+ (5. * (sqr((double)d.b() - d.a() + 1) - 1));
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::uniform_int_distribution<> D;
+ typedef std::ranlux48 G;
+ G g;
+ D d;
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.a() <= v && v <= d.b());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = ((double)d.a() + d.b()) / 2;
+ double x_var = (sqr((double)d.b() - d.a() + 1) - 1) / 12;
+ double x_skew = 0;
+ double x_kurtosis = -6. * (sqr((double)d.b() - d.a() + 1) + 1) /
+ (5. * (sqr((double)d.b() - d.a() + 1) - 1));
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::uniform_int_distribution<> D;
+ typedef std::knuth_b G;
+ G g;
+ D d;
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.a() <= v && v <= d.b());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = ((double)d.a() + d.b()) / 2;
+ double x_var = (sqr((double)d.b() - d.a() + 1) - 1) / 12;
+ double x_skew = 0;
+ double x_kurtosis = -6. * (sqr((double)d.b() - d.a() + 1) + 1) /
+ (5. * (sqr((double)d.b() - d.a() + 1) - 1));
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::uniform_int_distribution<> D;
+ typedef std::minstd_rand0 G;
+ G g;
+ D d(-6, 106);
+ for (int i = 0; i < 10000; ++i)
+ {
+ int u = d(g);
+ assert(-6 <= u && u <= 106);
+ }
+ }
+ {
+ typedef std::uniform_int_distribution<> D;
+ typedef std::minstd_rand G;
+ G g;
+ D d(5, 100);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.a() <= v && v <= d.b());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = ((double)d.a() + d.b()) / 2;
+ double x_var = (sqr((double)d.b() - d.a() + 1) - 1) / 12;
+ double x_skew = 0;
+ double x_kurtosis = -6. * (sqr((double)d.b() - d.a() + 1) + 1) /
+ (5. * (sqr((double)d.b() - d.a() + 1) - 1));
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eval_param.pass.cpp
new file mode 100644
index 000000000000..d83d48cac1e3
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eval_param.pass.cpp
@@ -0,0 +1,75 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class _IntType = int>
+// class uniform_int_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
+
+#include <random>
+#include <cassert>
+#include <vector>
+#include <numeric>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x * x;
+}
+
+int main()
+{
+ {
+ typedef std::uniform_int_distribution<> D;
+ typedef std::minstd_rand G;
+ typedef D::param_type P;
+ G g;
+ D d(5, 100);
+ P p(-10, 20);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ assert(p.a() <= v && v <= p.b());
+ u.push_back(v);
+ }
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = ((double)p.a() + p.b()) / 2;
+ double x_var = (sqr((double)p.b() - p.a() + 1) - 1) / 12;
+ double x_skew = 0;
+ double x_kurtosis = -6. * (sqr((double)p.b() - p.a() + 1) + 1) /
+ (5. * (sqr((double)p.b() - p.a() + 1) - 1));
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/get_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/get_param.pass.cpp
new file mode 100644
index 000000000000..ab8fa6c98363
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/get_param.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class _IntType = int>
+// class uniform_int_distribution
+
+// param_type param() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::uniform_int_distribution<> D;
+ typedef D::param_type P;
+ P p(3, 8);
+ D d(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/io.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/io.pass.cpp
new file mode 100644
index 000000000000..0220a5aa9570
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/io.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class _IntType = int>
+// class uniform_int_distribution
+
+// template <class charT, class traits>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& os,
+// const uniform_int_distribution& x);
+//
+// template <class charT, class traits>
+// basic_istream<charT, traits>&
+// operator>>(basic_istream<charT, traits>& is,
+// uniform_int_distribution& x);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::uniform_int_distribution<> D;
+ D d1(3, 8);
+ std::ostringstream os;
+ os << d1;
+ std::istringstream is(os.str());
+ D d2;
+ is >> d2;
+ assert(d1 == d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/max.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/max.pass.cpp
new file mode 100644
index 000000000000..c0a262f8a88c
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/max.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class _IntType = int>
+// class uniform_int_distribution
+
+// result_type max() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::uniform_int_distribution<> D;
+ D d(3, 8);
+ assert(d.max() == 8);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/min.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/min.pass.cpp
new file mode 100644
index 000000000000..3a0d3b2d94be
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/min.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class _IntType = int>
+// class uniform_int_distribution
+
+// result_type min() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::uniform_int_distribution<> D;
+ D d(3, 8);
+ assert(d.min() == 3);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/param_assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/param_assign.pass.cpp
new file mode 100644
index 000000000000..09c56097142d
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/param_assign.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class _IntType = int>
+// class uniform_int_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::uniform_int_distribution<long> D;
+ typedef D::param_type param_type;
+ param_type p0(5, 10);
+ param_type p;
+ p = p0;
+ assert(p.a() == 5);
+ assert(p.b() == 10);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/param_copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/param_copy.pass.cpp
new file mode 100644
index 000000000000..1f01e9858c34
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/param_copy.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class _IntType = int>
+// class uniform_int_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::uniform_int_distribution<long> D;
+ typedef D::param_type param_type;
+ param_type p0(5, 10);
+ param_type p = p0;
+ assert(p.a() == 5);
+ assert(p.b() == 10);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/param_ctor.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/param_ctor.pass.cpp
new file mode 100644
index 000000000000..eba933c01911
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/param_ctor.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class _IntType = int>
+// class uniform_int_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::uniform_int_distribution<long> D;
+ typedef D::param_type param_type;
+ param_type p;
+ assert(p.a() == 0);
+ assert(p.b() == std::numeric_limits<long>::max());
+ }
+ {
+ typedef std::uniform_int_distribution<long> D;
+ typedef D::param_type param_type;
+ param_type p(5);
+ assert(p.a() == 5);
+ assert(p.b() == std::numeric_limits<long>::max());
+ }
+ {
+ typedef std::uniform_int_distribution<long> D;
+ typedef D::param_type param_type;
+ param_type p(5, 10);
+ assert(p.a() == 5);
+ assert(p.b() == 10);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/param_eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/param_eq.pass.cpp
new file mode 100644
index 000000000000..5831f96b6b36
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/param_eq.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class _IntType = int>
+// class uniform_int_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::uniform_int_distribution<long> D;
+ typedef D::param_type param_type;
+ param_type p1(5, 10);
+ param_type p2(5, 10);
+ assert(p1 == p2);
+ }
+ {
+ typedef std::uniform_int_distribution<long> D;
+ typedef D::param_type param_type;
+ param_type p1(5, 10);
+ param_type p2(6, 10);
+ assert(p1 != p2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/param_types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/param_types.pass.cpp
new file mode 100644
index 000000000000..4022cfb6102b
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/param_types.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class _IntType = int>
+// class uniform_int_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::uniform_int_distribution<long> D;
+ typedef D::param_type param_type;
+ typedef param_type::distribution_type distribution_type;
+ static_assert((std::is_same<D, distribution_type>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/set_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/set_param.pass.cpp
new file mode 100644
index 000000000000..823837ba68e9
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/set_param.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class _IntType = int>
+// class uniform_int_distribution
+
+// void param(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::uniform_int_distribution<> D;
+ typedef D::param_type P;
+ P p(3, 8);
+ D d(6, 7);
+ d.param(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/types.pass.cpp
new file mode 100644
index 000000000000..65c01d037885
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/types.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class _IntType = int>
+// class uniform_int_distribution
+// {
+// typedef IntType result_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::uniform_int_distribution<long> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, long>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/assign.pass.cpp
new file mode 100644
index 000000000000..9651a2f0596b
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/assign.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class uniform_real_distribution
+
+// uniform_real_distribution& operator=(const uniform_real_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::uniform_real_distribution<float> D;
+ D d1(2, 5);
+ D d2;
+ assert(d1 != d2);
+ d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/copy.pass.cpp
new file mode 100644
index 000000000000..073c3a851570
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/copy.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class uniform_real_distribution
+
+// uniform_real_distribution(const uniform_real_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::uniform_real_distribution<float> D;
+ D d1(2, 5);
+ D d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/ctor_int_int.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/ctor_int_int.pass.cpp
new file mode 100644
index 000000000000..03abc5362108
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/ctor_int_int.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class uniform_real_distribution
+
+// explicit uniform_real_distribution(RealType a = 0,
+// RealType b = 1);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::uniform_real_distribution<> D;
+ D d;
+ assert(d.a() == 0);
+ assert(d.b() == 1);
+ }
+ {
+ typedef std::uniform_real_distribution<> D;
+ D d(-6);
+ assert(d.a() == -6);
+ assert(d.b() == 1);
+ }
+ {
+ typedef std::uniform_real_distribution<> D;
+ D d(-6, 106);
+ assert(d.a() == -6);
+ assert(d.b() == 106);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/ctor_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/ctor_param.pass.cpp
new file mode 100644
index 000000000000..a6f4aff93d81
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/ctor_param.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class uniform_real_distribution
+
+// explicit uniform_real_distribution(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::uniform_real_distribution<> D;
+ typedef D::param_type P;
+ P p(3.5, 8);
+ D d(p);
+ assert(d.a() == 3.5);
+ assert(d.b() == 8);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eq.pass.cpp
new file mode 100644
index 000000000000..5fcba4346dc1
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eq.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class uniform_real_distribution
+
+// bool operator=(const uniform_real_distribution& x,
+// const uniform_real_distribution& y);
+// bool operator!(const uniform_real_distribution& x,
+// const uniform_real_distribution& y);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::uniform_real_distribution<> D;
+ D d1(3, 8);
+ D d2(3, 8);
+ assert(d1 == d2);
+ }
+ {
+ typedef std::uniform_real_distribution<> D;
+ D d1(3, 8);
+ D d2(3, 8.1);
+ assert(d1 != d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval.pass.cpp
new file mode 100644
index 000000000000..2663b2683bb4
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval.pass.cpp
@@ -0,0 +1,474 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <random>
+
+// template<class RealType = double>
+// class uniform_real_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g);
+
+#include <random>
+#include <cassert>
+#include <vector>
+#include <numeric>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x * x;
+}
+
+int main()
+{
+ {
+ typedef std::uniform_real_distribution<> D;
+ typedef std::minstd_rand0 G;
+ G g;
+ D d;
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.a() <= v && v < d.b());
+ u.push_back(v);
+ }
+ D::result_type mean = std::accumulate(u.begin(), u.end(),
+ D::result_type(0)) / u.size();
+ D::result_type var = 0;
+ D::result_type skew = 0;
+ D::result_type kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ D::result_type d = (u[i] - mean);
+ D::result_type d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ D::result_type dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ D::result_type x_mean = (d.a() + d.b()) / 2;
+ D::result_type x_var = sqr(d.b() - d.a()) / 12;
+ D::result_type x_skew = 0;
+ D::result_type x_kurtosis = -6./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::uniform_real_distribution<> D;
+ typedef std::minstd_rand G;
+ G g;
+ D d;
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.a() <= v && v < d.b());
+ u.push_back(v);
+ }
+ D::result_type mean = std::accumulate(u.begin(), u.end(),
+ D::result_type(0)) / u.size();
+ D::result_type var = 0;
+ D::result_type skew = 0;
+ D::result_type kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ D::result_type d = (u[i] - mean);
+ D::result_type d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ D::result_type dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ D::result_type x_mean = (d.a() + d.b()) / 2;
+ D::result_type x_var = sqr(d.b() - d.a()) / 12;
+ D::result_type x_skew = 0;
+ D::result_type x_kurtosis = -6./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::uniform_real_distribution<> D;
+ typedef std::mt19937 G;
+ G g;
+ D d;
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.a() <= v && v < d.b());
+ u.push_back(v);
+ }
+ D::result_type mean = std::accumulate(u.begin(), u.end(),
+ D::result_type(0)) / u.size();
+ D::result_type var = 0;
+ D::result_type skew = 0;
+ D::result_type kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ D::result_type d = (u[i] - mean);
+ D::result_type d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ D::result_type dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ D::result_type x_mean = (d.a() + d.b()) / 2;
+ D::result_type x_var = sqr(d.b() - d.a()) / 12;
+ D::result_type x_skew = 0;
+ D::result_type x_kurtosis = -6./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::uniform_real_distribution<> D;
+ typedef std::mt19937_64 G;
+ G g;
+ D d;
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.a() <= v && v < d.b());
+ u.push_back(v);
+ }
+ D::result_type mean = std::accumulate(u.begin(), u.end(),
+ D::result_type(0)) / u.size();
+ D::result_type var = 0;
+ D::result_type skew = 0;
+ D::result_type kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ D::result_type d = (u[i] - mean);
+ D::result_type d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ D::result_type dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ D::result_type x_mean = (d.a() + d.b()) / 2;
+ D::result_type x_var = sqr(d.b() - d.a()) / 12;
+ D::result_type x_skew = 0;
+ D::result_type x_kurtosis = -6./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::uniform_real_distribution<> D;
+ typedef std::ranlux24_base G;
+ G g;
+ D d;
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.a() <= v && v < d.b());
+ u.push_back(v);
+ }
+ D::result_type mean = std::accumulate(u.begin(), u.end(),
+ D::result_type(0)) / u.size();
+ D::result_type var = 0;
+ D::result_type skew = 0;
+ D::result_type kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ D::result_type d = (u[i] - mean);
+ D::result_type d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ D::result_type dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ D::result_type x_mean = (d.a() + d.b()) / 2;
+ D::result_type x_var = sqr(d.b() - d.a()) / 12;
+ D::result_type x_skew = 0;
+ D::result_type x_kurtosis = -6./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.02);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::uniform_real_distribution<> D;
+ typedef std::ranlux48_base G;
+ G g;
+ D d;
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.a() <= v && v < d.b());
+ u.push_back(v);
+ }
+ D::result_type mean = std::accumulate(u.begin(), u.end(),
+ D::result_type(0)) / u.size();
+ D::result_type var = 0;
+ D::result_type skew = 0;
+ D::result_type kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ D::result_type d = (u[i] - mean);
+ D::result_type d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ D::result_type dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ D::result_type x_mean = (d.a() + d.b()) / 2;
+ D::result_type x_var = sqr(d.b() - d.a()) / 12;
+ D::result_type x_skew = 0;
+ D::result_type x_kurtosis = -6./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::uniform_real_distribution<> D;
+ typedef std::ranlux24 G;
+ G g;
+ D d;
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.a() <= v && v < d.b());
+ u.push_back(v);
+ }
+ D::result_type mean = std::accumulate(u.begin(), u.end(),
+ D::result_type(0)) / u.size();
+ D::result_type var = 0;
+ D::result_type skew = 0;
+ D::result_type kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ D::result_type d = (u[i] - mean);
+ D::result_type d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ D::result_type dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ D::result_type x_mean = (d.a() + d.b()) / 2;
+ D::result_type x_var = sqr(d.b() - d.a()) / 12;
+ D::result_type x_skew = 0;
+ D::result_type x_kurtosis = -6./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::uniform_real_distribution<> D;
+ typedef std::ranlux48 G;
+ G g;
+ D d;
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.a() <= v && v < d.b());
+ u.push_back(v);
+ }
+ D::result_type mean = std::accumulate(u.begin(), u.end(),
+ D::result_type(0)) / u.size();
+ D::result_type var = 0;
+ D::result_type skew = 0;
+ D::result_type kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ D::result_type d = (u[i] - mean);
+ D::result_type d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ D::result_type dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ D::result_type x_mean = (d.a() + d.b()) / 2;
+ D::result_type x_var = sqr(d.b() - d.a()) / 12;
+ D::result_type x_skew = 0;
+ D::result_type x_kurtosis = -6./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::uniform_real_distribution<> D;
+ typedef std::knuth_b G;
+ G g;
+ D d;
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.a() <= v && v < d.b());
+ u.push_back(v);
+ }
+ D::result_type mean = std::accumulate(u.begin(), u.end(),
+ D::result_type(0)) / u.size();
+ D::result_type var = 0;
+ D::result_type skew = 0;
+ D::result_type kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ D::result_type d = (u[i] - mean);
+ D::result_type d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ D::result_type dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ D::result_type x_mean = (d.a() + d.b()) / 2;
+ D::result_type x_var = sqr(d.b() - d.a()) / 12;
+ D::result_type x_skew = 0;
+ D::result_type x_kurtosis = -6./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::uniform_real_distribution<> D;
+ typedef std::minstd_rand G;
+ G g;
+ D d(-1, 1);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.a() <= v && v < d.b());
+ u.push_back(v);
+ }
+ D::result_type mean = std::accumulate(u.begin(), u.end(),
+ D::result_type(0)) / u.size();
+ D::result_type var = 0;
+ D::result_type skew = 0;
+ D::result_type kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ D::result_type d = (u[i] - mean);
+ D::result_type d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ D::result_type dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ D::result_type x_mean = (d.a() + d.b()) / 2;
+ D::result_type x_var = sqr(d.b() - d.a()) / 12;
+ D::result_type x_skew = 0;
+ D::result_type x_kurtosis = -6./5;
+ assert(std::abs(mean - x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+ {
+ typedef std::uniform_real_distribution<> D;
+ typedef std::minstd_rand G;
+ G g;
+ D d(5.5, 25);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g);
+ assert(d.a() <= v && v < d.b());
+ u.push_back(v);
+ }
+ D::result_type mean = std::accumulate(u.begin(), u.end(),
+ D::result_type(0)) / u.size();
+ D::result_type var = 0;
+ D::result_type skew = 0;
+ D::result_type kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ D::result_type d = (u[i] - mean);
+ D::result_type d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ D::result_type dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ D::result_type x_mean = (d.a() + d.b()) / 2;
+ D::result_type x_var = sqr(d.b() - d.a()) / 12;
+ D::result_type x_skew = 0;
+ D::result_type x_kurtosis = -6./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval_param.pass.cpp
new file mode 100644
index 000000000000..b5803f401465
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval_param.pass.cpp
@@ -0,0 +1,74 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class uniform_real_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
+
+#include <random>
+#include <cassert>
+#include <vector>
+#include <numeric>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x * x;
+}
+
+int main()
+{
+ {
+ typedef std::uniform_real_distribution<> D;
+ typedef std::minstd_rand G;
+ typedef D::param_type P;
+ G g;
+ D d(5.5, 25);
+ P p(-10, 20);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ {
+ D::result_type v = d(g, p);
+ assert(p.a() <= v && v < p.b());
+ u.push_back(v);
+ }
+ D::result_type mean = std::accumulate(u.begin(), u.end(),
+ D::result_type(0)) / u.size();
+ D::result_type var = 0;
+ D::result_type skew = 0;
+ D::result_type kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ D::result_type d = (u[i] - mean);
+ D::result_type d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ D::result_type dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ D::result_type x_mean = (p.a() + p.b()) / 2;
+ D::result_type x_var = sqr(p.b() - p.a()) / 12;
+ D::result_type x_skew = 0;
+ D::result_type x_kurtosis = -6./5;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/get_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/get_param.pass.cpp
new file mode 100644
index 000000000000..0496d853e329
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/get_param.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class uniform_real_distribution
+
+// param_type param() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::uniform_real_distribution<> D;
+ typedef D::param_type P;
+ P p(3, 8);
+ D d(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/io.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/io.pass.cpp
new file mode 100644
index 000000000000..17ff93889308
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/io.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class uniform_real_distribution
+
+// template <class charT, class traits>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& os,
+// const uniform_real_distribution& x);
+//
+// template <class charT, class traits>
+// basic_istream<charT, traits>&
+// operator>>(basic_istream<charT, traits>& is,
+// uniform_real_distribution& x);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::uniform_real_distribution<> D;
+ D d1(3, 8);
+ std::ostringstream os;
+ os << d1;
+ std::istringstream is(os.str());
+ D d2;
+ is >> d2;
+ assert(d1 == d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/max.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/max.pass.cpp
new file mode 100644
index 000000000000..6baa6d81a83c
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/max.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class uniform_real_distribution
+
+// result_type max() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::uniform_real_distribution<> D;
+ D d(3, 8);
+ assert(d.max() == 8);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/min.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/min.pass.cpp
new file mode 100644
index 000000000000..3974258c54df
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/min.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class uniform_real_distribution
+
+// result_type min() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::uniform_real_distribution<> D;
+ D d(3, 8);
+ assert(d.min() == 3);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/param_assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/param_assign.pass.cpp
new file mode 100644
index 000000000000..07497fef5316
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/param_assign.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class uniform_real_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::uniform_real_distribution<float> D;
+ typedef D::param_type param_type;
+ param_type p0(5, 10);
+ param_type p;
+ p = p0;
+ assert(p.a() == 5);
+ assert(p.b() == 10);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/param_copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/param_copy.pass.cpp
new file mode 100644
index 000000000000..d64df7dacb6b
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/param_copy.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class uniform_real_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::uniform_real_distribution<float> D;
+ typedef D::param_type param_type;
+ param_type p0(5, 10);
+ param_type p = p0;
+ assert(p.a() == 5);
+ assert(p.b() == 10);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/param_ctor.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/param_ctor.pass.cpp
new file mode 100644
index 000000000000..8f21ebfbdbb3
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/param_ctor.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class uniform_real_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::uniform_real_distribution<float> D;
+ typedef D::param_type param_type;
+ param_type p;
+ assert(p.a() == 0);
+ assert(p.b() == 1);
+ }
+ {
+ typedef std::uniform_real_distribution<float> D;
+ typedef D::param_type param_type;
+ param_type p(5);
+ assert(p.a() == 5);
+ assert(p.b() == 1);
+ }
+ {
+ typedef std::uniform_real_distribution<float> D;
+ typedef D::param_type param_type;
+ param_type p(5, 10);
+ assert(p.a() == 5);
+ assert(p.b() == 10);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/param_eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/param_eq.pass.cpp
new file mode 100644
index 000000000000..62df68ca628e
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/param_eq.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class uniform_real_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::uniform_real_distribution<float> D;
+ typedef D::param_type param_type;
+ param_type p1(5, 10);
+ param_type p2(5, 10);
+ assert(p1 == p2);
+ }
+ {
+ typedef std::uniform_real_distribution<float> D;
+ typedef D::param_type param_type;
+ param_type p1(5, 10);
+ param_type p2(6, 10);
+ assert(p1 != p2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/param_types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/param_types.pass.cpp
new file mode 100644
index 000000000000..27c0998be258
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/param_types.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class uniform_real_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::uniform_real_distribution<float> D;
+ typedef D::param_type param_type;
+ typedef param_type::distribution_type distribution_type;
+ static_assert((std::is_same<D, distribution_type>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/set_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/set_param.pass.cpp
new file mode 100644
index 000000000000..1ff121def104
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/set_param.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class uniform_real_distribution
+
+// void param(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::uniform_real_distribution<> D;
+ typedef D::param_type P;
+ P p(3, 8);
+ D d(6, 7);
+ d.param(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/types.pass.cpp
new file mode 100644
index 000000000000..b0e792fdd624
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/types.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType = double>
+// class uniform_real_distribution
+// {
+// typedef IntType result_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::uniform_real_distribution<float> D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, float>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.eng/nothing_to_do.pass.cpp b/test/std/numerics/rand/rand.eng/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..b58f5c55b643
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.lcong/assign.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.lcong/assign.pass.cpp
new file mode 100644
index 000000000000..8c09f4fd0109
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.lcong/assign.pass.cpp
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template <class UIntType, UIntType a, UIntType c, UIntType m>
+// class linear_congruential_engine;
+
+// linear_congruential_engine& operator=(const linear_congruential_engine&);
+
+#include <random>
+#include <cassert>
+
+template <class T, T a, T c, T m>
+void
+test1()
+{
+ typedef std::linear_congruential_engine<T, a, c, m> E;
+ E e1;
+ E e2;
+ assert(e1 == e2);
+ e1();
+ e2 = e1;
+ assert(e1 == e2);
+}
+
+template <class T>
+void
+test()
+{
+ test1<T, 0, 0, 0>();
+ test1<T, 0, 1, 2>();
+ test1<T, 1, 1, 2>();
+ const T M(~0);
+ test1<T, 0, 0, M>();
+ test1<T, 0, M-2, M>();
+ test1<T, 0, M-1, M>();
+ test1<T, M-2, 0, M>();
+ test1<T, M-2, M-2, M>();
+ test1<T, M-2, M-1, M>();
+ test1<T, M-1, 0, M>();
+ test1<T, M-1, M-2, M>();
+ test1<T, M-1, M-1, M>();
+}
+
+int main()
+{
+ test<unsigned short>();
+ test<unsigned int>();
+ test<unsigned long>();
+ test<unsigned long long>();
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.lcong/copy.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.lcong/copy.pass.cpp
new file mode 100644
index 000000000000..4b2b20da13ab
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.lcong/copy.pass.cpp
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template <class UIntType, UIntType a, UIntType c, UIntType m>
+// class linear_congruential_engine;
+
+// linear_congruential_engine(const linear_congruential_engine&);
+
+#include <random>
+#include <cassert>
+
+template <class T, T a, T c, T m>
+void
+test1()
+{
+ typedef std::linear_congruential_engine<T, a, c, m> E;
+ E e1;
+ E e2 = e1;
+ assert(e1 == e2);
+ e1();
+ e2();
+ assert(e1 == e2);
+}
+
+template <class T>
+void
+test()
+{
+ test1<T, 0, 0, 0>();
+ test1<T, 0, 1, 2>();
+ test1<T, 1, 1, 2>();
+ const T M(~0);
+ test1<T, 0, 0, M>();
+ test1<T, 0, M-2, M>();
+ test1<T, 0, M-1, M>();
+ test1<T, M-2, 0, M>();
+ test1<T, M-2, M-2, M>();
+ test1<T, M-2, M-1, M>();
+ test1<T, M-1, 0, M>();
+ test1<T, M-1, M-2, M>();
+ test1<T, M-1, M-1, M>();
+}
+
+int main()
+{
+ test<unsigned short>();
+ test<unsigned int>();
+ test<unsigned long>();
+ test<unsigned long long>();
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.lcong/ctor_result_type.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.lcong/ctor_result_type.pass.cpp
new file mode 100644
index 000000000000..311b7cd8f9b9
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.lcong/ctor_result_type.pass.cpp
@@ -0,0 +1,154 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template <class UIntType, UIntType a, UIntType c, UIntType m>
+// class linear_congruential_engine;
+
+// explicit linear_congruential_engine(result_type s = default_seed);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+template <class T>
+void
+test1()
+{
+ // c % m != 0 && s % m != 0
+ {
+ typedef std::linear_congruential_engine<T, 2, 3, 7> E;
+ E e(5);
+ std::ostringstream os;
+ os << e;
+ assert(os.str() == "5");
+ }
+ {
+ typedef std::linear_congruential_engine<T, 2, 3, 0> E;
+ E e(5);
+ std::ostringstream os;
+ os << e;
+ assert(os.str() == "5");
+ }
+ {
+ typedef std::linear_congruential_engine<T, 2, 3, 4> E;
+ E e(5);
+ std::ostringstream os;
+ os << e;
+ assert(os.str() == "1");
+ }
+}
+
+template <class T>
+void
+test2()
+{
+ // c % m != 0 && s % m == 0
+ {
+ typedef std::linear_congruential_engine<T, 2, 3, 7> E;
+ E e(7);
+ std::ostringstream os;
+ os << e;
+ assert(os.str() == "0");
+ }
+ {
+ typedef std::linear_congruential_engine<T, 2, 3, 0> E;
+ E e(0);
+ std::ostringstream os;
+ os << e;
+ assert(os.str() == "0");
+ }
+ {
+ typedef std::linear_congruential_engine<T, 2, 3, 4> E;
+ E e(4);
+ std::ostringstream os;
+ os << e;
+ assert(os.str() == "0");
+ }
+}
+
+template <class T>
+void
+test3()
+{
+ // c % m == 0 && s % m != 0
+ {
+ typedef std::linear_congruential_engine<T, 2, 0, 7> E;
+ E e(3);
+ std::ostringstream os;
+ os << e;
+ assert(os.str() == "3");
+ }
+ {
+ typedef std::linear_congruential_engine<T, 2, 0, 0> E;
+ E e(5);
+ std::ostringstream os;
+ os << e;
+ assert(os.str() == "5");
+ }
+ {
+ typedef std::linear_congruential_engine<T, 2, 0, 4> E;
+ E e(7);
+ std::ostringstream os;
+ os << e;
+ assert(os.str() == "3");
+ }
+}
+
+template <class T>
+void
+test4()
+{
+ // c % m == 0 && s % m == 0
+ {
+ typedef std::linear_congruential_engine<T, 2, 0, 7> E;
+ E e(7);
+ std::ostringstream os;
+ os << e;
+ assert(os.str() == "1");
+ }
+ {
+ typedef std::linear_congruential_engine<T, 2, 0, 0> E;
+ E e(0);
+ std::ostringstream os;
+ os << e;
+ assert(os.str() == "1");
+ }
+ {
+ typedef std::linear_congruential_engine<T, 2, 0, 4> E;
+ E e(8);
+ std::ostringstream os;
+ os << e;
+ assert(os.str() == "1");
+ }
+}
+
+int main()
+{
+ test1<unsigned short>();
+ test1<unsigned int>();
+ test1<unsigned long>();
+ test1<unsigned long long>();
+
+ test2<unsigned short>();
+ test2<unsigned int>();
+ test2<unsigned long>();
+ test2<unsigned long long>();
+
+ test3<unsigned short>();
+ test3<unsigned int>();
+ test3<unsigned long>();
+ test3<unsigned long long>();
+
+ test4<unsigned short>();
+ test4<unsigned int>();
+ test4<unsigned long>();
+ test4<unsigned long long>();
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.lcong/ctor_sseq.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.lcong/ctor_sseq.pass.cpp
new file mode 100644
index 000000000000..db7118f4a631
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.lcong/ctor_sseq.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template <class UIntType, UIntType a, UIntType c, UIntType m>
+// class linear_congruential_engine;
+
+// template<class Sseq> explicit linear_congruential_engine(Sseq& q);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ unsigned a[] = {3, 5, 7};
+ std::seed_seq sseq(a, a+3);
+ std::linear_congruential_engine<unsigned, 5, 7, 11> e1(sseq);
+ std::linear_congruential_engine<unsigned, 5, 7, 11> e2(4);
+ assert(e1 == e2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.lcong/default.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.lcong/default.pass.cpp
new file mode 100644
index 000000000000..6c4a7f434f12
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.lcong/default.pass.cpp
@@ -0,0 +1,57 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template <class UIntType, UIntType a, UIntType c, UIntType m>
+// class linear_congruential_engine;
+
+// linear_congruential_engine();
+
+#include <random>
+#include <cassert>
+
+template <class T, T a, T c, T m>
+void
+test1()
+{
+ typedef std::linear_congruential_engine<T, a, c, m> LCE;
+ typedef typename LCE::result_type result_type;
+ LCE e1;
+ LCE e2;
+ e2.seed();
+ assert(e1 == e2);
+}
+
+template <class T>
+void
+test()
+{
+ test1<T, 0, 0, 0>();
+ test1<T, 0, 1, 2>();
+ test1<T, 1, 1, 2>();
+ const T M(~0);
+ test1<T, 0, 0, M>();
+ test1<T, 0, M-2, M>();
+ test1<T, 0, M-1, M>();
+ test1<T, M-2, 0, M>();
+ test1<T, M-2, M-2, M>();
+ test1<T, M-2, M-1, M>();
+ test1<T, M-1, 0, M>();
+ test1<T, M-1, M-2, M>();
+ test1<T, M-1, M-1, M>();
+}
+
+int main()
+{
+ test<unsigned short>();
+ test<unsigned int>();
+ test<unsigned long>();
+ test<unsigned long long>();
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.lcong/discard.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.lcong/discard.pass.cpp
new file mode 100644
index 000000000000..9e3372a8c2b4
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.lcong/discard.pass.cpp
@@ -0,0 +1,73 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template <class UIntType, UIntType a, UIntType c, UIntType m>
+// class linear_congruential_engine;
+
+// void discard(unsigned long long z);
+
+#include <random>
+#include <cassert>
+
+template <class T>
+void
+rand0()
+{
+ typedef std::linear_congruential_engine<T, 16807, 0, 2147483647> E;
+ E e;
+ e.discard(9999);
+ assert(e() == 1043618065);
+}
+
+template <class T>
+void
+rand()
+{
+ typedef std::linear_congruential_engine<T, 48271, 0, 2147483647> E;
+ E e;
+ e.discard(9999);
+ assert(e() == 399268537);
+}
+
+template <class T>
+void
+other()
+{
+ typedef std::linear_congruential_engine<T, 48271, 123465789, 2147483647> E;
+ E e1;
+ E e2;
+ assert(e1 == e2);
+ e1.discard(1);
+ assert(e1 != e2);
+ e2();
+ assert(e1 == e2);
+ e1.discard(3);
+ assert(e1 != e2);
+ e2();
+ e2();
+ e2();
+ assert(e1 == e2);
+}
+
+int main()
+{
+ rand0<unsigned int>();
+ rand0<unsigned long>();
+ rand0<unsigned long long>();
+
+ rand<unsigned int>();
+ rand<unsigned long>();
+ rand<unsigned long long>();
+
+ other<unsigned int>();
+ other<unsigned long>();
+ other<unsigned long long>();
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.lcong/eval.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.lcong/eval.pass.cpp
new file mode 100644
index 000000000000..6d0057d598a8
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.lcong/eval.pass.cpp
@@ -0,0 +1,87 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template <class UIntType, UIntType a, UIntType c, UIntType m>
+// class linear_congruential_engine;
+
+// result_type operator()();
+
+#include <random>
+#include <cassert>
+
+template <class T>
+void
+randu()
+{
+ typedef std::linear_congruential_engine<T, 65539, 0, 2147483648u> E;
+ E e(1);
+ assert(e() == 65539);
+ assert(e() == 393225);
+ assert(e() == 1769499);
+ assert(e() == 7077969);
+ assert(e() == 26542323);
+ assert(e() == 95552217);
+ assert(e() == 334432395);
+ assert(e() == 1146624417);
+ assert(e() == 1722371299);
+ assert(e() == 14608041);
+ assert(e() == 1766175739);
+ assert(e() == 1875647473);
+}
+
+template <class T>
+void
+minstd()
+{
+ typedef std::linear_congruential_engine<T, 16807, 0, 2147483647> E;
+ E e(1);
+ assert(e() == 16807);
+ assert(e() == 282475249);
+ assert(e() == 1622650073);
+ assert(e() == 984943658);
+ assert(e() == 1144108930);
+ assert(e() == 470211272);
+ assert(e() == 101027544);
+ assert(e() == 1457850878);
+ assert(e() == 1458777923);
+ assert(e() == 2007237709);
+ assert(e() == 823564440);
+ assert(e() == 1115438165);
+}
+
+template <class T>
+void
+Haldir()
+{
+ typedef std::linear_congruential_engine<T, 16807, 78125, 2147483647> E;
+ E e(207560540);
+ assert(e() == 956631177);
+ assert(e() == 2037688522);
+ assert(e() == 1509348670);
+ assert(e() == 1546336451);
+ assert(e() == 429714088);
+ assert(e() == 217250280);
+}
+
+int main()
+{
+ randu<unsigned int>();
+ randu<unsigned long>();
+ randu<unsigned long long>();
+
+ minstd<unsigned int>();
+ minstd<unsigned long>();
+ minstd<unsigned long long>();
+
+ Haldir<unsigned int>();
+ Haldir<unsigned long>();
+ Haldir<unsigned long long>();
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.lcong/io.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.lcong/io.pass.cpp
new file mode 100644
index 000000000000..28ebdf23d0cb
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.lcong/io.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template <class UIntType, UIntType a, UIntType c, UIntType m>
+// class linear_congruential_engine;
+
+// template <class charT, class traits,
+// class UIntType, UIntType a, UIntType c, UIntType m>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& os,
+// const linear_congruential_engine<UIntType, a, c, m>& x);
+//
+// template <class charT, class traits,
+// class UIntType, UIntType a, UIntType c, UIntType m>
+// basic_istream<charT, traits>&
+// operator>>(basic_istream<charT, traits>& is,
+// linear_congruential_engine<UIntType, a, c, m>& x);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::linear_congruential_engine<unsigned, 48271, 0, 2147483647> E;
+ E e1;
+ e1.discard(100);
+ std::ostringstream os;
+ os << e1;
+ std::istringstream is(os.str());
+ E e2;
+ is >> e2;
+ assert(e1 == e2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.lcong/result_type.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.lcong/result_type.pass.cpp
new file mode 100644
index 000000000000..d261f1d93ab1
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.lcong/result_type.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template <class UIntType, UIntType a, UIntType c, UIntType m>
+// class linear_congruential_engine
+// {
+// public:
+// // types
+// typedef UIntType result_type;
+
+#include <random>
+#include <type_traits>
+
+template <class T>
+void
+test()
+{
+ static_assert((std::is_same<
+ typename std::linear_congruential_engine<T, 0, 0, 0>::result_type,
+ T>::value), "");
+}
+
+int main()
+{
+ test<unsigned short>();
+ test<unsigned int>();
+ test<unsigned long>();
+ test<unsigned long long>();
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.lcong/seed_result_type.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.lcong/seed_result_type.pass.cpp
new file mode 100644
index 000000000000..1afbe75efa58
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.lcong/seed_result_type.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template <class UIntType, UIntType a, UIntType c, UIntType m>
+// class linear_congruential_engine;
+
+// void seed(result_type s = default_seed);
+
+#include <random>
+#include <cassert>
+
+template <class T>
+void
+test1()
+{
+ for (int s = 0; s < 20; ++s)
+ {
+ typedef std::linear_congruential_engine<T, 2, 3, 7> E;
+ E e1(s);
+ E e2;
+ e2.seed(s);
+ assert(e1 == e2);
+ }
+}
+
+int main()
+{
+ test1<unsigned short>();
+ test1<unsigned int>();
+ test1<unsigned long>();
+ test1<unsigned long long>();
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.lcong/seed_sseq.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.lcong/seed_sseq.pass.cpp
new file mode 100644
index 000000000000..ca2793c7f9a7
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.lcong/seed_sseq.pass.cpp
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template <class UIntType, UIntType a, UIntType c, UIntType m>
+// class linear_congruential_engine;
+
+// template<class Sseq> void seed(Sseq& q);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ unsigned a[] = {3, 5, 7};
+ std::seed_seq sseq(a, a+3);
+ std::linear_congruential_engine<unsigned, 5, 7, 11> e1;
+ std::linear_congruential_engine<unsigned, 5, 7, 11> e2(4);
+ assert(e1 != e2);
+ e1.seed(sseq);
+ assert(e1 == e2);
+ }
+ {
+ unsigned a[] = {3, 5, 7, 9, 11};
+ std::seed_seq sseq(a, a+5);
+ typedef std::linear_congruential_engine<unsigned long long, 1, 1, 0x200000001ULL> E;
+ E e1(4309005589);
+ E e2(sseq);
+ assert(e1 == e2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp
new file mode 100644
index 000000000000..857a478a5579
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp
@@ -0,0 +1,74 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template <class UIntType, UIntType a, UIntType c, UIntType m>
+// class linear_congruential_engine
+// {
+// public:
+// engine characteristics
+// static constexpr result_type multiplier = a;
+// static constexpr result_type increment = c;
+// static constexpr result_type modulus = m;
+// static constexpr result_type min() { return c == 0u ? 1u: 0u;}
+// static constexpr result_type max() { return m - 1u;}
+// static constexpr result_type default_seed = 1u;
+
+#include <random>
+#include <type_traits>
+#include <cassert>
+
+template <class _Tp>
+void where(const _Tp &) {}
+
+template <class T, T a, T c, T m>
+void
+test1()
+{
+ typedef std::linear_congruential_engine<T, a, c, m> LCE;
+ typedef typename LCE::result_type result_type;
+ static_assert((LCE::multiplier == a), "");
+ static_assert((LCE::increment == c), "");
+ static_assert((LCE::modulus == m), "");
+ /*static_*/assert((LCE::min() == (c == 0u ? 1u: 0u))/*, ""*/);
+ /*static_*/assert((LCE::max() == result_type(m - 1u))/*, ""*/);
+ static_assert((LCE::default_seed == 1), "");
+ where(LCE::multiplier);
+ where(LCE::increment);
+ where(LCE::modulus);
+ where(LCE::default_seed);
+}
+
+template <class T>
+void
+test()
+{
+ test1<T, 0, 0, 0>();
+ test1<T, 0, 1, 2>();
+ test1<T, 1, 1, 2>();
+ const T M(~0);
+ test1<T, 0, 0, M>();
+ test1<T, 0, M-2, M>();
+ test1<T, 0, M-1, M>();
+ test1<T, M-2, 0, M>();
+ test1<T, M-2, M-2, M>();
+ test1<T, M-2, M-1, M>();
+ test1<T, M-1, 0, M>();
+ test1<T, M-1, M-2, M>();
+ test1<T, M-1, M-1, M>();
+}
+
+int main()
+{
+ test<unsigned short>();
+ test<unsigned int>();
+ test<unsigned long>();
+ test<unsigned long long>();
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.mers/assign.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.mers/assign.pass.cpp
new file mode 100644
index 000000000000..fda5b88de26e
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.mers/assign.pass.cpp
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template <class 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;
+
+// mersenne_twister_engine& operator=(const mersenne_twister_engine&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::mt19937 E;
+ E e1(2);
+ e1();
+ E e2(5);
+ e2 = e1;
+ assert(e1 == e2);
+ assert(e1() == e2());
+ E::result_type k = e1();
+ assert(e1 != e2);
+ assert(e2() == k);
+ assert(e1 == e2);
+}
+
+void
+test2()
+{
+ typedef std::mt19937_64 E;
+ E e1(3);
+ e1();
+ E e2(5);
+ e2 = e1;
+ assert(e1 == e2);
+ assert(e1() == e2());
+ E::result_type k = e1();
+ assert(e1 != e2);
+ assert(e2() == k);
+ assert(e1 == e2);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.mers/copy.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.mers/copy.pass.cpp
new file mode 100644
index 000000000000..57c015ccce1d
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.mers/copy.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template <class 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;
+
+// mersenne_twister_engine(const mersenne_twister_engine&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::mt19937 E;
+ E e1;
+ e1();
+ E e2 = e1;
+ assert(e1 == e2);
+ assert(e1() == e2());
+ E::result_type k = e1();
+ assert(e1 != e2);
+ assert(e2() == k);
+ assert(e1 == e2);
+}
+
+void
+test2()
+{
+ typedef std::mt19937_64 E;
+ E e1;
+ e1();
+ E e2(e1);
+ assert(e1 == e2);
+ assert(e1() == e2());
+ E::result_type k = e1();
+ assert(e1 != e2);
+ assert(e2() == k);
+ assert(e1 == e2);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.mers/ctor_result_type.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.mers/ctor_result_type.pass.cpp
new file mode 100644
index 000000000000..6920aaca558c
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.mers/ctor_result_type.pass.cpp
@@ -0,0 +1,245 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template <class 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;
+
+// explicit mersenne_twister_engine(result_type s = default_seed);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+void
+test1()
+{
+ const char* a = "0 1 1812433255 1900727105 1208447044 2481403966 4042607538 337614300 "
+ "3232553940 1018809052 3202401494 1775180719 3192392114 594215549 184016991 "
+ "829906058 610491522 3879932251 3139825610 297902587 4075895579 2943625357 "
+ "3530655617 1423771745 2135928312 2891506774 1066338622 135451537 933040465 "
+ "2759011858 2273819758 3545703099 2516396728 1272276355 3172048492 "
+ "3267256201 2332199830 1975469449 392443598 1132453229 2900699076 "
+ "1998300999 3847713992 512669506 1227792182 1629110240 112303347 2142631694 "
+ "3647635483 1715036585 2508091258 1355887243 1884998310 3906360088 "
+ "952450269 3647883368 3962623343 3077504981 2023096077 3791588343 "
+ "3937487744 3455116780 1218485897 1374508007 2815569918 1367263917 "
+ "472908318 2263147545 1461547499 4126813079 2383504810 64750479 2963140275 "
+ "1709368606 4143643781 835933993 1881494649 674663333 2076403047 858036109 "
+ "1667579889 1706666497 607785554 1995775149 1941986352 3448871082 "
+ "2109910019 1474883361 1623095288 1831376534 2612738285 81681830 2204289242 "
+ "1365038485 251164610 4268495337 1805601714 1262528768 1442526919 "
+ "1675006593 965627108 646339161 499795587 840887574 380522518 3023789847 "
+ "1457635507 1947093157 2600365344 2729853143 1550618999 1390905853 "
+ "3021294812 882647559 838872117 1663880796 4222103589 2754172275 3844026123 "
+ "3199260319 4176064873 3591027019 2690294242 2978135515 3172796441 "
+ "3263669796 1451257057 1427035359 4174826006 2171992010 1537002090 "
+ "3122405306 4162452508 3271954368 3794310005 3240514581 1270412086 "
+ "3030475836 2281945856 2644171349 3109139423 4253563838 1289926431 "
+ "1396919653 733220100 2753316645 1196225013 3699575255 3569440056 "
+ "2675979228 2624079148 3463113149 863430286 623703199 2113837653 2656425919 "
+ "175981357 4271478366 4238022735 1665483419 86880610 2963435083 1830392943 "
+ "847801865 3237296945 332143967 3973606945 2671879697 2236330279 2360127810 "
+ "3283955434 203240344 4048139172 13189264 2263058814 247241371 1566765783 "
+ "3084408095 3719371299 1958375251 1985924622 1712739232 1861691451 "
+ "2644502937 2337807839 784993770 2962208780 2190810177 1523122731 "
+ "714888527 578678761 3698481324 1801168075 534650483 3390213921 3923356461 "
+ "3586009066 2059432114 52511333 1969897376 3630122061 524661135 3513619765 "
+ "563070233 501359785 477489274 658768624 938973567 1548584683 1345287459 "
+ "2488691004 3441144905 3849305094 2430000078 855172178 614463281 2092744749 "
+ "176381493 1655802051 2273888101 2474494847 3471978030 2138918303 575352373 "
+ "1658230985 1675972553 2946663114 915579339 284981499 53939948 3022598146 "
+ "1861218535 3403620774 4203516930 2360471119 3134536268 1383448498 "
+ "1307602316 3847663247 3027225131 3597251613 3186237127 725127595 "
+ "1928526954 1843386923 3560410503 54688266 1791983849 2519860352 4256389699 "
+ "2328812602 486464275 3578698363 301279829 1303654791 4181868765 971794070 "
+ "1933885487 3996807464 2144053754 4079903755 3775774765 3481760044 "
+ "1212862354 1067356423 3764189132 1609862325 2209601551 2565747501 "
+ "161962392 4045451782 2605574664 2520953090 3490240017 1082791980 44474324 "
+ "101811128 4268650669 4171338684 772375154 3920460306 2319139534 599033750 "
+ "2950874441 3373922995 1496848525 4095253594 1271943484 1498723121 "
+ "3097453329 3698082465 281869581 3148270661 3591477288 747441437 2809508504 "
+ "3896107498 303747862 2368081624 1844217645 886825352 287949781 1444561207 "
+ "2512101757 2062331723 741720931 1383797313 3876746355 2041045348 "
+ "2627599118 1124169970 200524822 3484820454 55883666 1135054804 669498692 "
+ "2677215504 3097911127 1509628615 617580381 2229022193 85601568 3243896546 "
+ "3715672328 912168347 2359163500 1180347564 4243175048 2092067103 880183327 "
+ "4000664709 2045044777 3500474644 1515175520 1862207123 186628841 "
+ "3337252925 708933575 4015964629 3136815297 3314919747 2891909013 "
+ "3316567785 3944275369 3608506218 2884839110 3054055598 2707439927 "
+ "1381111877 3275487281 4292456216 2639563270 3327301876 3576924628 "
+ "721056309 2002808140 748967365 52380958 2200261692 763456477 1708381337 "
+ "2038446433 2682979402 1526413779 2211263302 3879771969 75966584 3645059271 "
+ "2985763524 4085690255 82390958 1883631385 1647521260 1598026998 3038041577 "
+ "2501913134 3279302868 1738888524 805035483 756399074 3863810982 1097797270 "
+ "1505792529 898904527 583561003 717152376 3333867738 1099456544 1663473545 "
+ "1242141229 3828627682 1966201676 1713552361 3852160017 1584965284 21695908 "
+ "1013262144 145341901 3995441263 3462066219 2239637848 1214086163 "
+ "2428868268 1650037305 1545513388 1621198806 4232947817 1823092073 "
+ "256414624 1745018809 1357102386 2055139770 3280958307 2482431613 "
+ "1664870585 859130423 4097751123 3079768369 2470211009 2984880786 "
+ "2808568948 2877071923 1984903163 302768457 1866396789 869566317 3746415787 "
+ "4169433075 3025005404 3980733379 3539207278 3953071536 876960847 "
+ "2548872156 800507464 1865466907 1273317878 3754712872 1757188269 "
+ "3229950355 3731640200 2283390608 2204990292 411873449 447423849 1852437802 "
+ "472825525 3044219944 2913114194 1859709265 4053786194 574820536 2104496732 "
+ "865469814 2438352724 4208743605 4215067542 1364015250 4139974345 "
+ "3838747005 1818502786 2914274940 1402365828 1751123528 2302578077 "
+ "2463168652 1968705496 1730700144 3023943273 1139096844 2658667767 "
+ "2063547264 705791165 1444775274 2415454225 1575664730 921044163 648101324 "
+ "1212387162 4191962054 1787702169 1888718041 1518218010 3398792842 "
+ "4079359729 149721439 750400353 2661036076 3802767886 520152586 951852508 "
+ "2939585975 1375969109 385733137 3523607459 1902438415 4250996086 "
+ "2712727066 484493674 3932107461 1428488210 1764242548 3424801055 "
+ "4004904451 2226862072 2393366939 3609584727 3614444319 317349896 "
+ "3826527525 204023804 981902443 3356042039 3051207045 1869902661 561831895 "
+ "3706675415 1527687593 1227610446 2596341042 3191717368 3269246891 "
+ "557877074 4062070629 3052520266 3772487029 400039836 3195205275 4085394797 "
+ "1655557239 1345770144 2864727192 449281238 73189507 528365765 2727400656 "
+ "247880434 2408277395 777039183 2210179398 1088433648 2124356402 1555630141 "
+ "604790219 195012151 3312518356 923728373 3999251660 3313059535 3478133921 "
+ "3395026960 383464614 3425869222 2446885186 4032184426 157195416 3158909476 "
+ "1663750443 2046427584 1658453076 1784483001 3146546889 1238739785 "
+ "2297306523 3472330897 2953326031 2421672215 1221694592 1588568605 "
+ "2546987845 3375168573 2137961649 3056565164 330165219 235900365 1000384800 "
+ "2697255904 579122283 3050664825 73426122 1232986102 2940571064 3076486824 "
+ "1708182873 2796363264 292154131 4280019913 1102652157 1185393592 "
+ "1494991690 4270076389 2384840717 425785147 2385321880 317514772 3926962743 "
+ "392176856 3465421709 1878853468 122662664 2958252160 1858961315 2244939588 "
+ "2361884409 2860936803 683833250 3291277128 1686857206 1112632275 "
+ "1200680507 3342928196 2677058150 939442136 3407104669 2906783932 "
+ "3668048733 2030009470 1910839172 1234925283 3575831445 123595418 "
+ "2362440495 3048484911 1796872496";
+ std::mt19937 e1(0);
+ std::ostringstream os;
+ os << e1;
+ assert(os.str() == a);
+}
+
+void
+test2()
+{
+ const char* a = "0 1 6364136223846793007 13885033948157127961 "
+ "15324573939901584278 12737837167382305846 15195339788985155882 "
+ "6554113247712070460 17235932740818599105 13007415075556305955 "
+ "6585479514541334743 8274505865835507625 1718218088692873364 "
+ "10390651247454232081 12911994993614796389 3986900029987203370 "
+ "6673827651897561714 4426752746717694792 7419158062930293690 "
+ "5800047417539173618 15710773105226458059 16164512590413496893 "
+ "3438015953120274172 3483801391287623267 293704481016263807 "
+ "11580856846363212652 3489109114147636336 3391036861618673611 "
+ "8265793309278544843 7557898467821912223 11008748280761875940 "
+ "15929443707841919885 8545695347411085846 10810459396490399532 "
+ "12233244910455127352 15556950738631379285 16711543556686614082 "
+ "12362193084052127890 16520645558585805174 5163125267185202360 "
+ "405552980610370477 17567412011316060306 18195950784827697319 "
+ "7893142112162906367 11294475722810961618 7284845498332539581 "
+ "8406882439401998138 4375387785957411470 9627875716250684710 "
+ "8860968026642934661 9743109216691708518 152611520104818631 "
+ "5897430410700879663 5351672954305365323 16325991383734641720 "
+ "9695181037355459478 15420132328343498044 17772146581546890572 "
+ "12095930435311226909 3066005052193896110 11579395203346116306 "
+ "9168946227698330317 18318927644793076250 16096433325093805476 "
+ "14945900876820434843 16826760579960858105 17664119339058295604 "
+ "17844797344364136942 1071414400549507565 16688779616725465582 "
+ "3684635020921274863 12774052823168116810 17270284502989966576 "
+ "1081012692742984704 4377021575203177546 18341292555997099853 "
+ "13297939683513494274 15065725504474304333 10796297883750572804 "
+ "15233335271871291997 8767977593699151062 3360856014170688284 "
+ "7828232912764786750 15167717223619970150 9622174963375022357 "
+ "18262792478991268448 1196631425707106493 5368342740538672272 "
+ "10381091599850241237 12108437846306626340 6150860188928778248 "
+ "3342980288459577584 12715439159457051276 17996971042887275859 "
+ "9749679821487730542 17763727344608586331 16024467606290078168 "
+ "7763401887585513696 4448278918811662063 16947956613780322662 "
+ "15144807360840708645 3878082612940188435 10709780449699561405 "
+ "1649555943517500922 3206645931693769562 12562913950237146427 "
+ "237213339742767727 12987800257476421358 1653669854585203688 "
+ "3485900643226898485 13961759114404652223 5243794832751327611 "
+ "10337687908642742498 16946139522050041809 16716562961992396380 "
+ "4275124606042261542 4055100795824867618 6424268654905981295 "
+ "3424516503413156556 2670380025813203539 10750762735193959951 "
+ "8790031149370411970 4021216986392972993 12076090355041998696 "
+ "14407920322903159838 10653597737935867030 15483225617438352002 "
+ "2497775263858626604 12295882369431088188 14256043521530136935 "
+ "2687322778627883798 3419797801078863201 8786888481486602641 "
+ "445698423634900693 9597067954623467255 7101345576557603992 "
+ "1498579197046783597 10403325187679734962 2464586980321053562 "
+ "2022012026329844477 10802281218030350853 6628929099856200904 "
+ "6828177972863192803 8589868113309334601 5245595233272009016 "
+ "5335692004673212054 4515133017699498525 15966447436053813932 "
+ "15199779177078162007 4190689609934804313 13003438276435994683 "
+ "8406046831313066396 10564320513686955057 12668913223662201488 "
+ "13130110932487580228 1030848205404711145 17684061609212954769 "
+ "12942207438298787911 10731611242140874687 5165052527778107352 "
+ "16323046249518133445 17119162873327029615 5754858052433703070 "
+ "3864761150247579030 9945988334920003074 11409854727071782565 "
+ "5000838138362434817 15526574143469400487 18094554078711846524 "
+ "5576294272011007484 3478525338408894755 11392694223389544658 "
+ "4692963068671452476 4459301637730340710 9699395817392066460 "
+ "14644636990626292085 18065377773424192622 5217202490849387226 "
+ "16175595974171756081 2109372019589047677 1624752883142646445 "
+ "13462209973053735966 12082930933973802402 1568864426788967895 "
+ "17047994306870001795 10556833209957537593 955604103878351641 "
+ "9062985603395234592 9757612676622840969 1767246562613391916 "
+ "9752598821733361274 7499745701633625047 7824811626141302622 "
+ "15819064077972391284 5660565551854829485 17645390577243129343 "
+ "7343780801046581776 2233358068547689666 8716657172695403744 "
+ "9129027798969787220 334709674395230649 2063182499026924878 "
+ "13089071159640936832 1765917316143960741 17552378408917656269 "
+ "3917018959478722819 15626740210483166037 1645962609209923821 "
+ "12277169606472643961 14545894350924442736 11485249378718653961 "
+ "9205208816702766530 10967561305613932827 3105992977398681914 "
+ "2125140299311648264 11619505070220308543 5030167448920096401 "
+ "4248170446421798953 16184577688118775567 9240607582885304823 "
+ "11838996733938359277 415426114101983968 14340734742548675134 "
+ "4124085748228276376 17686494750190224280 9472996569628985376 "
+ "1207013222233148636 3031046462562068367 45068538181330439 "
+ "8678647417835301152 10693327126492781235 3058899219097846020 "
+ "18377730418355022492 10269941972656742364 15986476992758938864 "
+ "14575856764093007010 14749682846448398393 1042926396621439263 "
+ "12184905641567868001 3518848236485931862 6718580865438347534 "
+ "6319395993260741012 2855168874111910691 2482146419106261786 "
+ "17290238774162848390 8071397865265268054 15873003794708011585 "
+ "14422764926380465297 14140979091525022882 3573480287238168646 "
+ "1525896111244666696 7537826952717918371 10482908122538761078 "
+ "17003233041653857 9473838740924911883 8438240966750123668 "
+ "10697754962581554225 15048771265786776312 9067877678399943713 "
+ "3399555692325948067 6150260207049997483 7165140289246675175 "
+ "14816202987105583988 4753550992948864498 10549400354582510015 "
+ "13212062554023586370 1585477630313819722 476999696494664205 "
+ "3208739183359199317 16011681780347380478 8149150693959772807 "
+ "803412833228911773 2360961455092949929 1517204230639934662 "
+ "13863717544358808032 16792122738584967930 12742474971940259289 "
+ "1859755681395355028 1540431035241590810 3883807554140904361 "
+ "16189061625447625933 12376367376041900879 8006563585771266211 "
+ "2682617767291542421 8593924529704142157 9070391845133329273 "
+ "3557484410564396342 9301398051805853085 12632514768298643219 "
+ "227653509634201118 7247795074312488552 4939136716843120792 "
+ "6533591052147596041 1308401457054431629 17488144120120152559 "
+ "14075631579093810083 4015705597302725704 6833920126528811473 "
+ "5095302940809114298 8312250184258072842 15770605014574863643 "
+ "14091690436120485477 15763282477731738396 16394237160547425954 "
+ "5066318118328746621 13140493775100916989 6371148952471982853 "
+ "15150289760867914983 4931341382074091848 12635920082410445322 "
+ "8498109357807439006 14836776625250834986";
+ std::mt19937_64 e1(0);
+ std::ostringstream os;
+ os << e1;
+ assert(os.str() == a);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.mers/ctor_sseq.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.mers/ctor_sseq.pass.cpp
new file mode 100644
index 000000000000..45bc493afb58
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.mers/ctor_sseq.pass.cpp
@@ -0,0 +1,309 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template <class 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;
+
+// template<class Sseq> explicit mersenne_twister_engine(Sseq& q);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+void
+test1()
+{
+ const char* a = "358595400 4166558815 2016177162 3414480257 "
+ "4027494649 3722317195 1190532340 3212207148 "
+ "3537847251 389019999 1098708832 3277907415 "
+ "1946784350 3608286140 2091419822 2227407035 "
+ "2229110723 1825348377 1276269279 314337202 "
+ "3182935337 1313150029 3118776508 3707918501 "
+ "1900972958 4054820954 3973178248 906260237 "
+ "1403942218 3139931556 2807126524 3940936448 "
+ "1316345796 631296613 2268418920 2914000794 "
+ "3760588399 3226216036 880155129 4183611084 "
+ "211541083 3755352858 1331383234 3036493096 "
+ "937478630 2092170412 777784402 93392729 "
+ "3644029210 1681392086 2427001226 3143870332 "
+ "3703581502 2017505388 1706274541 1049329728 "
+ "2452031492 3437261233 2581204087 1700889875 "
+ "1652573881 2127047692 3778506964 1960741508 "
+ "2739602360 3395905609 2123355622 3041272975 "
+ "784200748 3558951522 1002787860 4063320888 "
+ "1587315560 4042698976 659183308 3082256417 "
+ "2808969567 2361418535 3468698782 750700970 "
+ "2991209851 3581521382 962022878 2518967363 "
+ "1476525873 3865977235 2128790058 2380326689 "
+ "1396773405 312559410 1370621899 1154499924 "
+ "2963101919 2182689761 2071851902 1661288848 "
+ "2411351341 1362764020 1289894483 1951662807 "
+ "701821506 552267185 2356648449 3949188503 "
+ "1748307081 87795201 3718396254 4112205936 "
+ "2819888864 73923733 2800033151 839258139 "
+ "3801779069 3105962436 2111266436 1772784466 "
+ "3692264298 4148810953 3147390749 3537518553 "
+ "1695044978 1430225842 1252346204 3465285434 "
+ "3970017763 2920658411 2805151132 290569815 "
+ "3802301355 1493420394 1943029276 1667143611 "
+ "1049665988 1710824905 220168517 3997946231 "
+ "1014582791 4244598752 1147604069 2533886627 "
+ "598679964 761521020 431779255 3745982038 "
+ "768658283 3598262505 1765664789 279538641 "
+ "715144305 2371628432 2655860083 1759010423 "
+ "3568452003 1910107098 2801429529 3924547532 "
+ "3862672436 3933725740 1764550618 130893617 "
+ "1460692387 4135312761 2075529299 2880227367 "
+ "944557368 4166665482 2627749235 3732013815 "
+ "1595900818 1553312393 3529311831 3531462424 "
+ "2431328342 4075369692 1609967709 3704537555 "
+ "2067297464 397140475 920618678 2840795964 "
+ "4202512837 1286017648 7035910 1057207826 "
+ "2325188262 191593698 3697383848 3029712831 "
+ "2073681914 163454681 1329637200 290077398 "
+ "287239431 4205081522 1233889024 167173087 "
+ "3267660257 3406068803 2382354609 1680046927 "
+ "125183503 3559536309 3208900974 2912148541 "
+ "2882879316 1937001086 2919729069 892928802 "
+ "4141691387 2507406586 855548593 3418647837 "
+ "4035646154 2410275591 248715645 3180757482 "
+ "1880770722 362912336 2964920095 2319904154 "
+ "1493655850 4240733030 1834485846 1696040454 "
+ "3329457927 1865824694 847759208 1587231623 "
+ "3757294772 1161601118 3630323833 3007722125 "
+ "3726418007 2124238171 1205345 172659797 "
+ "3040354211 885213338 1857049013 447922412 "
+ "719906299 1370059380 1922204800 3960090489 "
+ "1658822644 1529626863 1565927273 3537718771 "
+ "2733237258 2180221377 921910745 2144937687 "
+ "1727603895 1315635304 4023867791 2401834107 "
+ "808854185 2408824497 343935326 185237544 "
+ "746732759 2641236122 4283215329 743609415 "
+ "1134726665 3892851319 1302851263 3473445597 "
+ "1326817414 2702766508 1943179285 4025685468 "
+ "932896770 199392138 2787362875 3450501893 "
+ "3351567147 2461286528 2227605848 2993751114 "
+ "3988215720 1320573368 2866560199 4153194990 "
+ "3007120042 3260751955 3171763740 2111121243 "
+ "3962825228 102681859 3368179132 802089147 "
+ "4029273561 424939445 4178414761 2592125109 "
+ "1960801088 2967746406 310701990 2364200202 "
+ "1320507009 3474372480 784693947 2952246664 "
+ "1891935330 2048385105 3530082191 3238151038 "
+ "3293189141 1316053288 2087004409 740799958 "
+ "1187748554 3607767334 1190185990 1408429481 "
+ "657134359 221834425 3907725865 1068016389 "
+ "1402423875 2598612116 2046886300 2345022518 "
+ "1196081924 357783981 4013683598 463491626 "
+ "3269206482 3332444286 886491955 2257342866 "
+ "475911113 833576299 2893727564 2866985145 "
+ "1413365115 2995166393 1486060436 161205225 "
+ "3181728373 3056027137 2040371876 2182305146 "
+ "3028448628 2214316977 1266227021 876938740 "
+ "276477469 752158077 2182179045 1381698878 "
+ "3424557652 666674427 968327842 2534296575 "
+ "265105940 961112540 2641188117 2319139814 "
+ "1750453329 3450138343 678025317 1477566458 "
+ "3773796420 2933993832 3326042905 4084805260 "
+ "444182455 255333481 785163068 2321290820 "
+ "2893603234 3005520266 541104079 1383277090 "
+ "2770755666 3764627833 583371929 2864949033 "
+ "1487681116 1811788361 240329486 3094213377 "
+ "958509875 2564379085 1636995945 2070894127 "
+ "2139004232 1747850055 3841512327 3325011872 "
+ "1161622604 639182193 3533652535 4022667522 "
+ "761048999 3337743670 254221568 2784956233 "
+ "2990252814 4207922787 275707208 261819597 "
+ "2071467265 4034945770 1999813410 3038921100 "
+ "2200194573 1328217451 2440612380 3862293692 "
+ "2733976812 2750523058 2920082515 3809044908 "
+ "4285231753 3131963297 3481602724 1396460739 "
+ "2011767965 2481047764 2958452120 3044188618 "
+ "2217236658 3448605566 757716104 1818279145 "
+ "2641228144 1312649639 1194087684 3845229729 "
+ "1747658356 874418803 1956637337 268670179 "
+ "2083040240 2577671381 3375334655 2587828868 "
+ "1383012799 3583445685 2594576715 3282337104 "
+ "4257972751 3440488071 3129180313 1830891395 "
+ "1594931092 2680778339 3984026324 1102770400 "
+ "2315820258 1263467048 1133254110 2400676748 "
+ "2251795328 1036154092 3313541051 2277356560 "
+ "1477696003 1417117088 3968537402 1404882202 "
+ "2011058180 4114080985 1727459502 4100235708 "
+ "2334509310 2829432554 377936301 1519324520 "
+ "3252826644 1193335837 1929125820 2165344238 "
+ "4160556243 223340988 670907625 1485396519 "
+ "936389509 3813712964 2706450987 3132506320 "
+ "875886515 557088991 2854916639 2955496008 "
+ "2881696287 265169077 3239923698 3649366121 "
+ "4072165960 1233904959 225406526 1767368993 "
+ "1894882500 2296582180 339255168 83200939 "
+ "2958376148 4100205346 1991250823 3806183082 "
+ "2691709980 2642354997 3024056146 1681065839 "
+ "3438299684 1638853652 362567001 2307868899 "
+ "988801086 1342833399 2303298376 1500039911 "
+ "765489391 4080464497 4155444368 980472018 "
+ "2026981853 3460406995 391970367 667377014 "
+ "4177754853 2657468948 3560690175 3030464357 "
+ "2948380657 1208800977 2316451404 4001932203 "
+ "1977856863 4265848271 3116200050 3037586215 "
+ "1335232764 930230766 1026089249 2482219415 "
+ "2613853154 1854543497 2909555107 3862874043 "
+ "2609355500 907364682 383900687 358164223 "
+ "232347546 2536276737 3118482806 1254103998 "
+ "2357334077 1204777304 1996643329 4046232717 "
+ "2570520290 3173323380 1201411457 2361883023 "
+ "806087062 2984143714 2355127569 864220085 "
+ "1787696713 1182652984 4200065581 100722519 "
+ "2380458669 2429592313 2618338302 1236529564 "
+ "1747130196 3711661325 1114068102 510380433 "
+ "93703089 2277774664 3220741441 1577998569 "
+ "2816701900 4206763045 2495239107 4080390459 "
+ "1307072677 20360728 1468385549 96049834 "
+ "3630657447 2809517346 3396111678 3043831060 "
+ "673178359 4256729562 1755211210 1969834535 "
+ "498315110 3717726302 1544859987 2239930949 "
+ "1595372585 294525219 3961637067 3591840665 "
+ "3324896933 2300077772 721255886 4197934760 "
+ "1468866696 2184812884 628246683 3385113037 "
+ "3041166140 3948531843 1176600829 228286131 "
+ "2447397608 712235937 3332826819 2676980703 "
+ "4019468871 1952389952 1202638254 3625447051";
+ unsigned as[] = {3, 5, 7};
+ std::seed_seq sseq(as, as+3);
+ std::mt19937 e1(sseq);
+ std::ostringstream os;
+ os << e1;
+ assert(os.str() == a);
+}
+
+void
+test2()
+{
+ const char* a = "17895233847644109640 14665081038668852234 15987230621890949369 "
+ "13796324649827964148 1670828176732799955 14078505147839608672 "
+ "15497470967856861790 9566640372296747182 7839811585250789315 "
+ "1350068003782415071 5639936432479386921 15925388701147119804 "
+ "17415323390466493342 3892358083553387400 13485903346102334794 "
+ "16926193162581531132 2711398308226914244 12515538113016451944 "
+ "13856492368211347055 17968472785843263993 16129117710261673051 "
+ "13041638543181171650 8985803498136324582 401118717516975186 "
+ "7221524024767248666 13502820261231663498 8665119664667372350 "
+ "4506836866186850029 14762924585995667460 7305266389803732087 "
+ "9135600275824854713 8421320656548229332 14585303533697565624 "
+ "13062167967956981222 15285580395823625260 17451830328116466708 "
+ "17363259891080004456 13238190509560321740 10142215382802200927 "
+ "3224236118694175902 15382517208605932923 10818882444738383326 "
+ "16604245792882032433 10223425285179753002 1342432445403828765 "
+ "4958539418185107403 9374581143772158175 7135181273441366910 "
+ "5853026900476841261 8382327930174454355 2371969498930803266 "
+ "16961635468480846337 377077518789053577 17661790013255465310 "
+ "317500018453124832 3604586262706855295 13340007089026272125 "
+ "7614051306438090372 17819007364113857386 15193526497275633437 "
+ "6142773218979108210 14883287611587512668 12544132362002344419 "
+ "1247987855434921372 6414191755211735979 7160327288923375132 "
+ "7347937017206972868 17171048313531629893 18230412825496997383 "
+ "10882960195884354661 3270707876715241884 16088870345045208503 "
+ "15454419782166694763 1200609322828949525 10186066554418904177 "
+ "7554892242763986291 8203847521335919011 16855803304338943001 "
+ "16895223408596071476 562183806034700250 17761033068687156643 "
+ "12370482348384718931 17895691979506634040 16028877286272943475 "
+ "6671425930002400146 15167515621662197335 17503579548680921174 "
+ "15910867647138768989 1705705354110203064 12201125760909412022 "
+ "5523403744441352645 4540673037752294406 822888669354888870 "
+ "13012517529113958824 702032511346794490 1245872939048413008 "
+ "18060687614291143943 718002942670251776 14628954120078526945 "
+ "7215746609592654001 15288092036204733967 12507582747898016110 "
+ "8319356319569362772 3835100005166188461 10769229288786702843 "
+ "14682980657311687345 10352054841727718090 13661249361946024317 "
+ "1558696616315734178 9963912474249467679 18213809676410642730 "
+ "7284438284457478230 8013656044128665351 6817107912809760616 "
+ "4989038816564331700 12918068165960947833 9123533477086273623 "
+ "741568181450204257 3801962339733348259 1923812112542486965 "
+ "5884360231397942779 17008459141377852544 6569697353326895092 "
+ "15194386425456240489 9363979514988323850 9212437218544795097 "
+ "5650610605870621879 10315798944006232463 10345822437227504297 "
+ "795589193815296350 11344022765750598871 3193778122705907169 "
+ "16719669104430190089 14918335244853046975 11608293761910939782 "
+ "17290187430985633813 856382712722415618 14819792788008454203 "
+ "10571145147196955435 12858063129221173592 5671819431516788648 "
+ "17837836658827607239 14004823010100183722 9067196699747632668 "
+ "441015230260308492 3444946658209715644 1825101023084664281 "
+ "11133092574473850025 12746373758552339264 10154162549097295782 "
+ "14922316177042921089 12679802872389794491 8797747037480461410 "
+ "13907752811248535439 5652405835046458389 3181711594575177977 "
+ "15495242712294857418 6049158560807439366 952771601159099159 "
+ "4587095466254740009 11160954054611782211 10071795025240457628 "
+ "1536670498623767300 1990681379653546894 14312739227381277138 "
+ "9695213786215402291 3580182943401628617 12313607438786545484 "
+ "12864141705426648443 692371170805382036 13125536612285239925 "
+ "9372929234002877092 9510419002221032820 3766423210161674061 "
+ "3230494342413727261 5934351496112072933 2863344864469097044 "
+ "10884720908958139042 4127946927340597780 9960629658622711061 "
+ "14818231351611083857 6346099615454582885 12601407558879514692 "
+ "17544105005554819865 1096648950913019831 9969868157190185788 "
+ "12908611252828823970 5941129863397152719 16168953427117105234 "
+ "12304862402025196697 7781571759256122972 13289545261301048078 "
+ "11013924305579914035 8894422550580466537 7506958826675805512 "
+ "14280817252893250439 2745266616282182732 17277225453205013047 "
+ "14335499905842065319 11961295941780577536 18072890757248426766 "
+ "1124506606842606920 17329960125355005185 13052066741624159010 "
+ "5704650516221677069 16588425097127709212 11813406583737887980 "
+ "16359723311775411283 13451679937172566665 5997753207634594468 "
+ "10656019008205694109 13074690560123889048 14811648124990806194 "
+ "7809449463531558024 5637787273252434288 16515135932856030468 "
+ "3755600163640125044 1153929634172103321 11071014283313196016 "
+ "11114640359080035583 15390782025450330559 14097530518721927499 "
+ "14776783751481098767 7863618667181998233 11513855295425132436 "
+ "4736362806980864724 5426549653049482466 10310828122060887518 "
+ "4450247941008370560 9781171949844602811 6086471549040450051 "
+ "6033923116291003194 17669843285681524740 17610378273478865070 "
+ "12152320288002263294 6525449125788834221 5125338396312613396 "
+ "9300082688721166268 959242243476884691 6379729471368150249 "
+ "16379772457647614853 13454012201619761707 2392678998182524851 "
+ "12693758700673471007 1138892516507202079 15673908144065302514 "
+ "5299581449349386824 7590792025124859454 9863745357571267780 "
+ "357345312340746112 17610247870912740564 16347431861769737095 "
+ "11348828299228888092 7220122803951857490 7038822841708464676 "
+ "9912221445023094105 5767425533670320190 6442622362743049032 "
+ "17525461567869579503 4211095256108567696 14862334876401617373 "
+ "2866362449624104511 11413742225973279461 13015745308569358847 "
+ "5191760666536228849 17188167935010684492 18321678815621002079 "
+ "13046333455321624690 3995310719038261500 10661051209947341089 "
+ "7965203671238327266 16590917686161852835 3897101637344795372 "
+ "1538303624766151695 10893225639252940698 5386335660311332214 "
+ "5174479122000384061 17378437193516866561 13629320139302700770 "
+ "10144210341964027265 12816799659000064406 3711797003976467729 "
+ "5079455890584507977 432599929275804205 10435019529328454317 "
+ "5310854040535477246 15941464006450157396 2192067269367387270 "
+ "9782967689631091633 6777452250210540865 18067909703113078220 "
+ "17525143578810667971 87448662189824165 412530897284614413 "
+ "12066785122245373863 13073154860645125438 18282514257379582711 "
+ "8460374908111578570 15967512883067334502 9620430172798103891 "
+ "1264976185047610409 15426838192579528907 9878758812321441445 "
+ "18029992505662864846 9383699886128308360 14538949787806484635 "
+ "16958815135940772668 980481467951972605 3059030058898313960 "
+ "11497544574740915907 8385450996898478663 15571176518627282350";
+ unsigned as[] = {3, 5, 7};
+ std::seed_seq sseq(as, as+3);
+ std::mt19937_64 e1(sseq);
+ std::ostringstream os;
+ os << e1;
+ assert(os.str() == a);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.mers/default.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.mers/default.pass.cpp
new file mode 100644
index 000000000000..d92ffd807da0
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.mers/default.pass.cpp
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template <class 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;
+
+// explicit mersenne_twister_engine();
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+void
+test1()
+{
+ std::mt19937 e1;
+ std::mt19937 e2(std::mt19937::default_seed);
+ assert(e1 == e2);
+ assert(e1() == 3499211612u);
+}
+
+void
+test2()
+{
+ std::mt19937_64 e1;
+ std::mt19937_64 e2(std::mt19937_64::default_seed);
+ assert(e1 == e2);
+ assert(e1() == 14514284786278117030ull);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.mers/discard.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.mers/discard.pass.cpp
new file mode 100644
index 000000000000..d20d661d5891
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.mers/discard.pass.cpp
@@ -0,0 +1,55 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template <class 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;
+
+// void discard(unsigned long long z);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+void
+test1()
+{
+ std::mt19937 e1;
+ std::mt19937 e2 = e1;
+ assert(e1 == e2);
+ e1.discard(3);
+ assert(e1 != e2);
+ e2();
+ e2();
+ e2();
+ assert(e1 == e2);
+}
+
+void
+test2()
+{
+ std::mt19937_64 e1;
+ std::mt19937_64 e2 = e1;
+ assert(e1 == e2);
+ e1.discard(3);
+ assert(e1 != e2);
+ e2();
+ e2();
+ e2();
+ assert(e1 == e2);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.mers/eval.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.mers/eval.pass.cpp
new file mode 100644
index 000000000000..0b17a8577067
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.mers/eval.pass.cpp
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template <class 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;
+
+// result_type operator()();
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+void
+test1()
+{
+ std::mt19937 e;
+ assert(e() == 3499211612u);
+ assert(e() == 581869302u);
+ assert(e() == 3890346734u);
+}
+
+void
+test2()
+{
+ std::mt19937_64 e;
+ assert(e() == 14514284786278117030ull);
+ assert(e() == 4620546740167642908ull);
+ assert(e() == 13109570281517897720ull);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.mers/io.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.mers/io.pass.cpp
new file mode 100644
index 000000000000..28e00ec1eb88
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.mers/io.pass.cpp
@@ -0,0 +1,69 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template <class 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;
+
+// template <class charT, class traits,
+// class 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>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& os,
+// const mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>& x);
+//
+// template <class charT, class traits,
+// class 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>
+// basic_ostream<charT, traits>&
+// operator>>(basic_istream<charT, traits>& is,
+// mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>& x);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::mt19937 E;
+ E e1;
+ e1.discard(100);
+ std::ostringstream os;
+ os << e1;
+ std::istringstream is(os.str());
+ E e2;
+ is >> e2;
+ assert(e1 == e2);
+}
+
+void
+test2()
+{
+ typedef std::mt19937_64 E;
+ E e1;
+ e1.discard(100);
+ std::ostringstream os;
+ os << e1;
+ std::istringstream is(os.str());
+ E e2;
+ is >> e2;
+ assert(e1 == e2);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.mers/result_type.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.mers/result_type.pass.cpp
new file mode 100644
index 000000000000..26f3e1563295
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.mers/result_type.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template <class 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
+// {
+// public:
+// // types
+// typedef UIntType result_type;
+
+#include <random>
+#include <type_traits>
+
+void
+test1()
+{
+ static_assert((std::is_same<
+ std::mt19937::result_type,
+ std::uint_fast32_t>::value), "");
+}
+
+void
+test2()
+{
+ static_assert((std::is_same<
+ std::mt19937_64::result_type,
+ std::uint_fast64_t>::value), "");
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.mers/seed_result_type.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.mers/seed_result_type.pass.cpp
new file mode 100644
index 000000000000..6f93e5beb9b5
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.mers/seed_result_type.pass.cpp
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template <class 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;
+
+// void seed(result_type s = default_seed);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ for (int s = 0; s < 20; ++s)
+ {
+ typedef std::mt19937 E;
+ E e1(s);
+ E e2;
+ e2.seed(s);
+ assert(e1 == e2);
+ }
+}
+
+void
+test2()
+{
+ for (int s = 0; s < 20; ++s)
+ {
+ typedef std::mt19937_64 E;
+ E e1(s);
+ E e2;
+ e2.seed(s);
+ assert(e1 == e2);
+ }
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.mers/seed_sseq.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.mers/seed_sseq.pass.cpp
new file mode 100644
index 000000000000..33292a041af4
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.mers/seed_sseq.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template <class 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;
+
+// template<class Sseq> void seed(Sseq& q);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ unsigned a[] = {3, 5, 7};
+ std::seed_seq sseq(a, a+3);
+ std::mt19937 e1;
+ std::mt19937 e2(sseq);
+ assert(e1 != e2);
+ e1.seed(sseq);
+ assert(e1 == e2);
+}
+
+void
+test2()
+{
+ unsigned a[] = {3, 5, 7};
+ std::seed_seq sseq(a, a+3);
+ std::mt19937_64 e1;
+ std::mt19937_64 e2(sseq);
+ assert(e1 != e2);
+ e1.seed(sseq);
+ assert(e1 == e2);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.mers/values.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.mers/values.pass.cpp
new file mode 100644
index 000000000000..331d3c51119f
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.mers/values.pass.cpp
@@ -0,0 +1,122 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template <class 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
+// {
+// public:
+// // types
+// typedef UIntType result_type;
+//
+// // engine characteristics
+// static constexpr size_t word_size = w;
+// static constexpr size_t state_size = n;
+// static constexpr size_t shift_size = m;
+// static constexpr size_t mask_bits = r;
+// static constexpr result_type xor_mask = a;
+// static constexpr size_t tempering_u = u;
+// static constexpr result_type tempering_d = d;
+// static constexpr size_t tempering_s = s;
+// static constexpr result_type tempering_b = b;
+// static constexpr size_t tempering_t = t;
+// static constexpr result_type tempering_c = c;
+// static constexpr size_t tempering_l = l;
+// static constexpr result_type initialization_multiplier = f;
+// static constexpr result_type min () { return 0; }
+// static constexpr result_type max() { return 2^w - 1; }
+// static constexpr result_type default_seed = 5489u;
+
+#include <random>
+#include <type_traits>
+#include <cassert>
+
+template <class _Tp>
+void where(const _Tp &) {}
+
+void
+test1()
+{
+ typedef std::mt19937 E;
+ static_assert((E::word_size == 32), "");
+ static_assert((E::state_size == 624), "");
+ static_assert((E::shift_size == 397), "");
+ static_assert((E::mask_bits == 31), "");
+ static_assert((E::xor_mask == 0x9908b0df), "");
+ static_assert((E::tempering_u == 11), "");
+ static_assert((E::tempering_d == 0xffffffff), "");
+ static_assert((E::tempering_s == 7), "");
+ static_assert((E::tempering_b == 0x9d2c5680), "");
+ static_assert((E::tempering_t == 15), "");
+ static_assert((E::tempering_c == 0xefc60000), "");
+ static_assert((E::tempering_l == 18), "");
+ static_assert((E::initialization_multiplier == 1812433253), "");
+ /*static_*/assert((E::min() == 0)/*, ""*/);
+ /*static_*/assert((E::max() == 0xFFFFFFFF)/*, ""*/);
+ static_assert((E::default_seed == 5489u), "");
+ where(E::word_size);
+ where(E::state_size);
+ where(E::shift_size);
+ where(E::mask_bits);
+ where(E::xor_mask);
+ where(E::tempering_u);
+ where(E::tempering_d);
+ where(E::tempering_s);
+ where(E::tempering_b);
+ where(E::tempering_t);
+ where(E::tempering_c);
+ where(E::tempering_l);
+ where(E::initialization_multiplier);
+ where(E::default_seed);
+}
+
+void
+test2()
+{
+ typedef std::mt19937_64 E;
+ static_assert((E::word_size == 64), "");
+ static_assert((E::state_size == 312), "");
+ static_assert((E::shift_size == 156), "");
+ static_assert((E::mask_bits == 31), "");
+ static_assert((E::xor_mask == 0xb5026f5aa96619e9ull), "");
+ static_assert((E::tempering_u == 29), "");
+ static_assert((E::tempering_d == 0x5555555555555555ull), "");
+ static_assert((E::tempering_s == 17), "");
+ static_assert((E::tempering_b == 0x71d67fffeda60000ull), "");
+ static_assert((E::tempering_t == 37), "");
+ static_assert((E::tempering_c == 0xfff7eee000000000ull), "");
+ static_assert((E::tempering_l == 43), "");
+ static_assert((E::initialization_multiplier == 6364136223846793005ull), "");
+ /*static_*/assert((E::min() == 0)/*, ""*/);
+ /*static_*/assert((E::max() == 0xFFFFFFFFFFFFFFFFull)/*, ""*/);
+ static_assert((E::default_seed == 5489u), "");
+ where(E::word_size);
+ where(E::state_size);
+ where(E::shift_size);
+ where(E::mask_bits);
+ where(E::xor_mask);
+ where(E::tempering_u);
+ where(E::tempering_d);
+ where(E::tempering_s);
+ where(E::tempering_b);
+ where(E::tempering_t);
+ where(E::tempering_c);
+ where(E::tempering_l);
+ where(E::initialization_multiplier);
+ where(E::default_seed);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.sub/assign.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.sub/assign.pass.cpp
new file mode 100644
index 000000000000..305d43ad4a22
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.sub/assign.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class UIntType, size_t w, size_t s, size_t r>
+// class subtract_with_carry_engine;
+
+// subtract_with_carry_engine& operator=(const subtract_with_carry_engine&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::ranlux24_base E;
+ E e1(2);
+ e1();
+ E e2(5);
+ e2 = e1;
+ assert(e1 == e2);
+ assert(e1() == e2());
+ E::result_type k = e1();
+ assert(e1 != e2);
+ assert(e2() == k);
+ assert(e1 == e2);
+}
+
+void
+test2()
+{
+ typedef std::ranlux48_base E;
+ E e1(3);
+ e1();
+ E e2(5);
+ e2 = e1;
+ assert(e1 == e2);
+ assert(e1() == e2());
+ E::result_type k = e1();
+ assert(e1 != e2);
+ assert(e2() == k);
+ assert(e1 == e2);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.sub/copy.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.sub/copy.pass.cpp
new file mode 100644
index 000000000000..27f88165bcf5
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.sub/copy.pass.cpp
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class UIntType, size_t w, size_t s, size_t r>
+// class subtract_with_carry_engine;
+
+// subtract_with_carry_engine(const subtract_with_carry_engine&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::ranlux24_base E;
+ E e1;
+ e1();
+ E e2 = e1;
+ assert(e1 == e2);
+ assert(e1() == e2());
+ E::result_type k = e1();
+ assert(e1 != e2);
+ assert(e2() == k);
+ assert(e1 == e2);
+}
+
+void
+test2()
+{
+ typedef std::ranlux48_base E;
+ E e1;
+ e1();
+ E e2(e1);
+ assert(e1 == e2);
+ assert(e1() == e2());
+ E::result_type k = e1();
+ assert(e1 != e2);
+ assert(e2() == k);
+ assert(e1 == e2);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.sub/ctor_result_type.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.sub/ctor_result_type.pass.cpp
new file mode 100644
index 000000000000..429298dfcd88
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.sub/ctor_result_type.pass.cpp
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class UIntType, size_t w, size_t s, size_t r>
+// class subtract_with_carry_engine;
+
+// explicit subtract_with_carry_engine(result_type s = default_seed);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+void
+test1()
+{
+ const char* a = "15136306 8587749 2346244 16479026 15515802 9510553 "
+ "16090340 14501685 13839944 10789678 11581259 9590790 5840316 5953700 "
+ "13398366 8134459 16629731 6851902 15583892 1317475 4231148 9092691 "
+ "5707268 2355175 0";
+ std::ranlux24_base e1(0);
+ std::ostringstream os;
+ os << e1;
+ assert(os.str() == a);
+}
+
+void
+test2()
+{
+ const char* a = "10880375256626 126660097854724 33643165434010 "
+ "78293780235492 179418984296008 96783156950859 238199764491708 "
+ "34339434557790 155299155394531 29014415493780 209265474179052 "
+ "263777435457028 0";
+ std::ranlux48_base e1(0);
+ std::ostringstream os;
+ os << e1;
+ assert(os.str() == a);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.sub/ctor_sseq.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.sub/ctor_sseq.pass.cpp
new file mode 100644
index 000000000000..893f6dc34a4b
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.sub/ctor_sseq.pass.cpp
@@ -0,0 +1,55 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class UIntType, size_t w, size_t s, size_t r>
+// class subtract_with_carry_engine;
+
+// template<class Sseq> explicit subtract_with_carry_engine(Sseq& q);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+void
+test1()
+{
+ const char* a = "13604817 711567 9760686 13278398 3323440 175548 5553651 "
+ "3028863 10748297 2216688 275779 14778841 14438394 9483441 4229545 "
+ "14657301 12636508 15978210 1653340 1718567 9272421 14302862 7940348 "
+ "889045 0";
+ unsigned as[] = {3, 5, 7};
+ std::seed_seq sseq(as, as+3);
+ std::ranlux24_base e1(sseq);
+ std::ostringstream os;
+ os << e1;
+ assert(os.str() == a);
+}
+
+void
+test2()
+{
+ const char* a = "241408498702289 172342669275054 191026374555184 "
+ "61020585639411 231929771458953 142769679250755 198672786411514 "
+ "183712717244841 227473912549724 62843577252444 68782400568421 "
+ "159248704678140 0";
+ unsigned as[] = {3, 5, 7};
+ std::seed_seq sseq(as, as+3);
+ std::ranlux48_base e1(sseq);
+ std::ostringstream os;
+ os << e1;
+ assert(os.str() == a);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.sub/default.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.sub/default.pass.cpp
new file mode 100644
index 000000000000..56e8759d1e60
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.sub/default.pass.cpp
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class UIntType, size_t w, size_t s, size_t r>
+// class subtract_with_carry_engine;
+
+// explicit subtract_with_carry_engine();
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ std::ranlux24_base e1;
+ std::ranlux24_base e2(std::ranlux24_base::default_seed);
+ assert(e1 == e2);
+ assert(e1() == 15039276);
+}
+
+void
+test2()
+{
+ std::ranlux48_base e1;
+ std::ranlux48_base e2(std::ranlux48_base::default_seed);
+ assert(e1 == e2);
+ assert(e1() == 23459059301164ull);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.sub/discard.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.sub/discard.pass.cpp
new file mode 100644
index 000000000000..4ba93819ee43
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.sub/discard.pass.cpp
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class UIntType, size_t w, size_t s, size_t r>
+// class subtract_with_carry_engine;
+
+// void discard(unsigned long long z);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ std::ranlux24_base e1;
+ std::ranlux24_base e2 = e1;
+ assert(e1 == e2);
+ e1.discard(3);
+ assert(e1 != e2);
+ e2();
+ e2();
+ e2();
+ assert(e1 == e2);
+}
+
+void
+test2()
+{
+ std::ranlux48_base e1;
+ std::ranlux48_base e2 = e1;
+ assert(e1 == e2);
+ e1.discard(3);
+ assert(e1 != e2);
+ e2();
+ e2();
+ e2();
+ assert(e1 == e2);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.sub/eval.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.sub/eval.pass.cpp
new file mode 100644
index 000000000000..44829944be73
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.sub/eval.pass.cpp
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class UIntType, size_t w, size_t s, size_t r>
+// class subtract_with_carry_engine;
+
+// result_type operator()();
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ std::ranlux24_base e;
+ assert(e() == 15039276u);
+ assert(e() == 16323925u);
+ assert(e() == 14283486u);
+}
+
+void
+test2()
+{
+ std::ranlux48_base e;
+ assert(e() == 23459059301164ull);
+ assert(e() == 28639057539807ull);
+ assert(e() == 276846226770426ull);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.sub/io.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.sub/io.pass.cpp
new file mode 100644
index 000000000000..834f5f69c777
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.sub/io.pass.cpp
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class UIntType, size_t w, size_t s, size_t r>
+// class subtract_with_carry_engine;
+
+// template <class charT, class traits,
+// class UIntType, size_t w, size_t s, size_t r>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& os,
+// const subtract_with_carry_engine<UIntType, w, s, r>& x);
+//
+// template <class charT, class traits,
+// class UIntType, size_t w, size_t s, size_t r>
+// basic_istream<charT, traits>&
+// operator>>(basic_istream<charT, traits>& is,
+// subtract_with_carry_engine<UIntType, w, s, r>& x);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::ranlux24_base E;
+ E e1;
+ e1.discard(100);
+ std::ostringstream os;
+ os << e1;
+ std::istringstream is(os.str());
+ E e2;
+ is >> e2;
+ assert(e1 == e2);
+}
+
+void
+test2()
+{
+ typedef std::ranlux48_base E;
+ E e1;
+ e1.discard(100);
+ std::ostringstream os;
+ os << e1;
+ std::istringstream is(os.str());
+ E e2;
+ is >> e2;
+ assert(e1 == e2);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.sub/result_type.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.sub/result_type.pass.cpp
new file mode 100644
index 000000000000..6af195b49923
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.sub/result_type.pass.cpp
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class UIntType, size_t w, size_t s, size_t r>
+// class subtract_with_carry_engine
+// {
+// public:
+// // types
+// typedef UIntType result_type;
+
+#include <random>
+#include <type_traits>
+
+void
+test1()
+{
+ static_assert((std::is_same<
+ std::ranlux24_base::result_type,
+ std::uint_fast32_t>::value), "");
+}
+
+void
+test2()
+{
+ static_assert((std::is_same<
+ std::ranlux48_base::result_type,
+ std::uint_fast64_t>::value), "");
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.sub/seed_result_type.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.sub/seed_result_type.pass.cpp
new file mode 100644
index 000000000000..fa6e741da920
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.sub/seed_result_type.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class UIntType, size_t w, size_t s, size_t r>
+// class subtract_with_carry_engine;
+
+// void seed(result_type s = default_seed);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ for (int s = 0; s < 20; ++s)
+ {
+ typedef std::ranlux24_base E;
+ E e1(s);
+ E e2;
+ e2.seed(s);
+ assert(e1 == e2);
+ }
+}
+
+void
+test2()
+{
+ for (int s = 0; s < 20; ++s)
+ {
+ typedef std::ranlux48_base E;
+ E e1(s);
+ E e2;
+ e2.seed(s);
+ assert(e1 == e2);
+ }
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.sub/seed_sseq.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.sub/seed_sseq.pass.cpp
new file mode 100644
index 000000000000..347077278e61
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.sub/seed_sseq.pass.cpp
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class UIntType, size_t w, size_t s, size_t r>
+// class subtract_with_carry_engine;
+
+// template<class Sseq> void seed(Sseq& q);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ unsigned a[] = {3, 5, 7};
+ std::seed_seq sseq(a, a+3);
+ std::ranlux24_base e1;
+ std::ranlux24_base e2(sseq);
+ assert(e1 != e2);
+ e1.seed(sseq);
+ assert(e1 == e2);
+}
+
+void
+test2()
+{
+ unsigned a[] = {3, 5, 7};
+ std::seed_seq sseq(a, a+3);
+ std::ranlux48_base e1;
+ std::ranlux48_base e2(sseq);
+ assert(e1 != e2);
+ e1.seed(sseq);
+ assert(e1 == e2);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.sub/values.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.sub/values.pass.cpp
new file mode 100644
index 000000000000..75716a43deae
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.sub/values.pass.cpp
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class UIntType, size_t w, size_t s, size_t r>
+// class subtract_with_carry_engine
+// {
+// public:
+// // types
+// typedef UIntType result_type;
+//
+// // engine characteristics
+// static constexpr size_t word_size = w;
+// static constexpr size_t short_lag = s;
+// static constexpr size_t long_lag = r;
+// static constexpr result_type min() { return 0; }
+// static constexpr result_type max() { return m-1; }
+// static constexpr result_type default_seed = 19780503u;
+
+#include <random>
+#include <type_traits>
+#include <cassert>
+
+template <class _Tp>
+void where(const _Tp &) {}
+
+void
+test1()
+{
+ typedef std::ranlux24_base E;
+ static_assert((E::word_size == 24), "");
+ static_assert((E::short_lag == 10), "");
+ static_assert((E::long_lag == 24), "");
+ /*static_*/assert((E::min() == 0)/*, ""*/);
+ /*static_*/assert((E::max() == 0xFFFFFF)/*, ""*/);
+ static_assert((E::default_seed == 19780503u), "");
+ where(E::word_size);
+ where(E::short_lag);
+ where(E::long_lag);
+ where(E::default_seed);
+}
+
+void
+test2()
+{
+ typedef std::ranlux48_base E;
+ static_assert((E::word_size == 48), "");
+ static_assert((E::short_lag == 5), "");
+ static_assert((E::long_lag == 12), "");
+ /*static_*/assert((E::min() == 0)/*, ""*/);
+ /*static_*/assert((E::max() == 0xFFFFFFFFFFFFull)/*, ""*/);
+ static_assert((E::default_seed == 19780503u), "");
+ where(E::word_size);
+ where(E::short_lag);
+ where(E::long_lag);
+ where(E::default_seed);
+}
+
+int main()
+{
+ test1();
+ test2();
+}
diff --git a/test/std/numerics/rand/rand.predef/default_random_engine.pass.cpp b/test/std/numerics/rand/rand.predef/default_random_engine.pass.cpp
new file mode 100644
index 000000000000..426586007c1a
--- /dev/null
+++ b/test/std/numerics/rand/rand.predef/default_random_engine.pass.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// typedef minstd_rand0 default_random_engine;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ std::default_random_engine e;
+ e.discard(9999);
+ assert(e() == 399268537u);
+}
diff --git a/test/std/numerics/rand/rand.predef/knuth_b.pass.cpp b/test/std/numerics/rand/rand.predef/knuth_b.pass.cpp
new file mode 100644
index 000000000000..69627d79e907
--- /dev/null
+++ b/test/std/numerics/rand/rand.predef/knuth_b.pass.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// typedef shuffle_order_engine<minstd_rand0, 256> knuth_b;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ std::knuth_b e;
+ e.discard(9999);
+ assert(e() == 1112339016u);
+}
diff --git a/test/std/numerics/rand/rand.predef/minstd_rand.pass.cpp b/test/std/numerics/rand/rand.predef/minstd_rand.pass.cpp
new file mode 100644
index 000000000000..891e5cce6d85
--- /dev/null
+++ b/test/std/numerics/rand/rand.predef/minstd_rand.pass.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// typedef linear_congruential_engine<uint_fast32_t, 48271, 0, 2147483647>
+// minstd_rand;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ std::minstd_rand e;
+ e.discard(9999);
+ assert(e() == 399268537u);
+}
diff --git a/test/std/numerics/rand/rand.predef/minstd_rand0.pass.cpp b/test/std/numerics/rand/rand.predef/minstd_rand0.pass.cpp
new file mode 100644
index 000000000000..63848cf95065
--- /dev/null
+++ b/test/std/numerics/rand/rand.predef/minstd_rand0.pass.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// typedef linear_congruential_engine<uint_fast32_t, 16807, 0, 2147483647>
+// minstd_rand0;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ std::minstd_rand0 e;
+ e.discard(9999);
+ assert(e() == 1043618065u);
+}
diff --git a/test/std/numerics/rand/rand.predef/mt19937.pass.cpp b/test/std/numerics/rand/rand.predef/mt19937.pass.cpp
new file mode 100644
index 000000000000..e3a79364a1f5
--- /dev/null
+++ b/test/std/numerics/rand/rand.predef/mt19937.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// typedef mersenne_twister_engine<uint_fast32_t, 32, 624, 397, 31,
+// 0x9908b0df,
+// 11, 0xffffffff,
+// 7, 0x9d2c5680,
+// 15, 0xefc60000,
+// 18, 1812433253> mt19937;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ std::mt19937 e;
+ e.discard(9999);
+ assert(e() == 4123659995u);
+}
diff --git a/test/std/numerics/rand/rand.predef/mt19937_64.pass.cpp b/test/std/numerics/rand/rand.predef/mt19937_64.pass.cpp
new file mode 100644
index 000000000000..67896d2260f4
--- /dev/null
+++ b/test/std/numerics/rand/rand.predef/mt19937_64.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// typedef mersenne_twister_engine<uint_fast64_t, 64, 312, 156, 31,
+// 0xb5026f5aa96619e9,
+// 29, 0x5555555555555555,
+// 17, 0x71d67fffeda60000,
+// 37, 0xfff7eee000000000,
+// 43, 6364136223846793005> mt19937_64;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ std::mt19937_64 e;
+ e.discard(9999);
+ assert(e() == 9981545732273789042ull);
+}
diff --git a/test/std/numerics/rand/rand.predef/ranlux24.pass.cpp b/test/std/numerics/rand/rand.predef/ranlux24.pass.cpp
new file mode 100644
index 000000000000..529586af9f42
--- /dev/null
+++ b/test/std/numerics/rand/rand.predef/ranlux24.pass.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// typedef discard_block_engine<ranlux24_base, 223, 23> ranlux24;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ std::ranlux24 e;
+ e.discard(9999);
+ assert(e() == 9901578u);
+}
diff --git a/test/std/numerics/rand/rand.predef/ranlux24_base.pass.cpp b/test/std/numerics/rand/rand.predef/ranlux24_base.pass.cpp
new file mode 100644
index 000000000000..f7311469dcbf
--- /dev/null
+++ b/test/std/numerics/rand/rand.predef/ranlux24_base.pass.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// typedef subtract_with_carry_engine<uint_fast32_t, 24, 10, 24> ranlux24_base;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ std::ranlux24_base e;
+ e.discard(9999);
+ assert(e() == 7937952u);
+}
diff --git a/test/std/numerics/rand/rand.predef/ranlux48.pass.cpp b/test/std/numerics/rand/rand.predef/ranlux48.pass.cpp
new file mode 100644
index 000000000000..f15dfd5493e2
--- /dev/null
+++ b/test/std/numerics/rand/rand.predef/ranlux48.pass.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// typedef discard_block_engine<ranlux48_base, 389, 11> ranlux48;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ std::ranlux48 e;
+ e.discard(9999);
+ assert(e() == 249142670248501ull);
+}
diff --git a/test/std/numerics/rand/rand.predef/ranlux48_base.pass.cpp b/test/std/numerics/rand/rand.predef/ranlux48_base.pass.cpp
new file mode 100644
index 000000000000..4c3df3e1dce8
--- /dev/null
+++ b/test/std/numerics/rand/rand.predef/ranlux48_base.pass.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// typedef subtract_with_carry_engine<uint_fast64_t, 48, 5, 12> ranlux48_base;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ std::ranlux48_base e;
+ e.discard(9999);
+ assert(e() == 61839128582725ull);
+}
diff --git a/test/std/numerics/rand/rand.req/nothing_to_do.pass.cpp b/test/std/numerics/rand/rand.req/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..b58f5c55b643
--- /dev/null
+++ b/test/std/numerics/rand/rand.req/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/numerics/rand/rand.req/rand.req.adapt/nothing_to_do.pass.cpp b/test/std/numerics/rand/rand.req/rand.req.adapt/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..b58f5c55b643
--- /dev/null
+++ b/test/std/numerics/rand/rand.req/rand.req.adapt/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/numerics/rand/rand.req/rand.req.dst/nothing_to_do.pass.cpp b/test/std/numerics/rand/rand.req/rand.req.dst/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..b58f5c55b643
--- /dev/null
+++ b/test/std/numerics/rand/rand.req/rand.req.dst/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/numerics/rand/rand.req/rand.req.eng/nothing_to_do.pass.cpp b/test/std/numerics/rand/rand.req/rand.req.eng/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..b58f5c55b643
--- /dev/null
+++ b/test/std/numerics/rand/rand.req/rand.req.eng/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/numerics/rand/rand.req/rand.req.genl/nothing_to_do.pass.cpp b/test/std/numerics/rand/rand.req/rand.req.genl/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..b58f5c55b643
--- /dev/null
+++ b/test/std/numerics/rand/rand.req/rand.req.genl/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/numerics/rand/rand.req/rand.req.seedseq/nothing_to_do.pass.cpp b/test/std/numerics/rand/rand.req/rand.req.seedseq/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..b58f5c55b643
--- /dev/null
+++ b/test/std/numerics/rand/rand.req/rand.req.seedseq/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/numerics/rand/rand.req/rand.req.urng/nothing_to_do.pass.cpp b/test/std/numerics/rand/rand.req/rand.req.urng/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..b58f5c55b643
--- /dev/null
+++ b/test/std/numerics/rand/rand.req/rand.req.urng/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/numerics/rand/rand.synopsis/version.pass.cpp b/test/std/numerics/rand/rand.synopsis/version.pass.cpp
new file mode 100644
index 000000000000..eae6c493e919
--- /dev/null
+++ b/test/std/numerics/rand/rand.synopsis/version.pass.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+#include <random>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}
diff --git a/test/std/numerics/rand/rand.util/nothing_to_do.pass.cpp b/test/std/numerics/rand/rand.util/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..b58f5c55b643
--- /dev/null
+++ b/test/std/numerics/rand/rand.util/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/numerics/rand/rand.util/rand.util.canonical/generate_canonical.pass.cpp b/test/std/numerics/rand/rand.util/rand.util.canonical/generate_canonical.pass.cpp
new file mode 100644
index 000000000000..7433e28e4935
--- /dev/null
+++ b/test/std/numerics/rand/rand.util/rand.util.canonical/generate_canonical.pass.cpp
@@ -0,0 +1,100 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template<class RealType, size_t bits, class URNG>
+// RealType generate_canonical(URNG& g);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::minstd_rand0 E;
+ typedef float F;
+ E r;
+ F f = std::generate_canonical<F, 0>(r);
+ assert(f == (16807 - E::min()) / (E::max() - E::min() + F(1)));
+ }
+ {
+ typedef std::minstd_rand0 E;
+ typedef float F;
+ E r;
+ F f = std::generate_canonical<F, 1>(r);
+ assert(f == (16807 - E::min()) / (E::max() - E::min() + F(1)));
+ }
+ {
+ typedef std::minstd_rand0 E;
+ typedef float F;
+ E r;
+ F f = std::generate_canonical<F, std::numeric_limits<F>::digits - 1>(r);
+ assert(f == (16807 - E::min()) / (E::max() - E::min() + F(1)));
+ }
+ {
+ typedef std::minstd_rand0 E;
+ typedef float F;
+ E r;
+ F f = std::generate_canonical<F, std::numeric_limits<F>::digits>(r);
+ assert(f == (16807 - E::min()) / (E::max() - E::min() + F(1)));
+ }
+ {
+ typedef std::minstd_rand0 E;
+ typedef float F;
+ E r;
+ F f = std::generate_canonical<F, std::numeric_limits<F>::digits + 1>(r);
+ assert(f == (16807 - E::min()) / (E::max() - E::min() + F(1)));
+ }
+
+ {
+ typedef std::minstd_rand0 E;
+ typedef double F;
+ E r;
+ F f = std::generate_canonical<F, 0>(r);
+ assert(f == (16807 - E::min()) / (E::max() - E::min() + F(1)));
+ }
+ {
+ typedef std::minstd_rand0 E;
+ typedef double F;
+ E r;
+ F f = std::generate_canonical<F, 1>(r);
+ assert(f == (16807 - E::min()) / (E::max() - E::min() + F(1)));
+ }
+ {
+ typedef std::minstd_rand0 E;
+ typedef double F;
+ E r;
+ F f = std::generate_canonical<F, std::numeric_limits<F>::digits - 1>(r);
+ assert(f ==
+ (16807 - E::min() +
+ (282475249 - E::min()) * (E::max() - E::min() + F(1))) /
+ ((E::max() - E::min() + F(1)) * (E::max() - E::min() + F(1))));
+ }
+ {
+ typedef std::minstd_rand0 E;
+ typedef double F;
+ E r;
+ F f = std::generate_canonical<F, std::numeric_limits<F>::digits>(r);
+ assert(f ==
+ (16807 - E::min() +
+ (282475249 - E::min()) * (E::max() - E::min() + F(1))) /
+ ((E::max() - E::min() + F(1)) * (E::max() - E::min() + F(1))));
+ }
+ {
+ typedef std::minstd_rand0 E;
+ typedef double F;
+ E r;
+ F f = std::generate_canonical<F, std::numeric_limits<F>::digits + 1>(r);
+ assert(f ==
+ (16807 - E::min() +
+ (282475249 - E::min()) * (E::max() - E::min() + F(1))) /
+ ((E::max() - E::min() + F(1)) * (E::max() - E::min() + F(1))));
+ }
+}
diff --git a/test/std/numerics/rand/rand.util/rand.util.seedseq/assign.fail.cpp b/test/std/numerics/rand/rand.util/rand.util.seedseq/assign.fail.cpp
new file mode 100644
index 000000000000..6b5d75042d3b
--- /dev/null
+++ b/test/std/numerics/rand/rand.util/rand.util.seedseq/assign.fail.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class seed_seq;
+
+// seed_seq();
+
+#include <random>
+
+int main()
+{
+ std::seed_seq s0;
+ std::seed_seq s;
+ s = s0;
+}
diff --git a/test/std/numerics/rand/rand.util/rand.util.seedseq/copy.fail.cpp b/test/std/numerics/rand/rand.util/rand.util.seedseq/copy.fail.cpp
new file mode 100644
index 000000000000..cf260fcc01e8
--- /dev/null
+++ b/test/std/numerics/rand/rand.util/rand.util.seedseq/copy.fail.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class seed_seq;
+
+// seed_seq();
+
+#include <random>
+
+int main()
+{
+ std::seed_seq s0;
+ std::seed_seq s(s0);
+}
diff --git a/test/std/numerics/rand/rand.util/rand.util.seedseq/default.pass.cpp b/test/std/numerics/rand/rand.util/rand.util.seedseq/default.pass.cpp
new file mode 100644
index 000000000000..bf4210aa9950
--- /dev/null
+++ b/test/std/numerics/rand/rand.util/rand.util.seedseq/default.pass.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class seed_seq;
+
+// seed_seq();
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ std::seed_seq s;
+ assert(s.size() == 0);
+}
diff --git a/test/std/numerics/rand/rand.util/rand.util.seedseq/generate.pass.cpp b/test/std/numerics/rand/rand.util/rand.util.seedseq/generate.pass.cpp
new file mode 100644
index 000000000000..9712f61d681c
--- /dev/null
+++ b/test/std/numerics/rand/rand.util/rand.util.seedseq/generate.pass.cpp
@@ -0,0 +1,805 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class seed_seq;
+
+// template<class RandomAccessIterator>
+// void generate(RandomAccessIterator begin, RandomAccessIterator end);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ // These numbers generated from a slightly altered version of dSFMT
+ // http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html
+ unsigned a[] =
+ {
+ 509928861u,
+ 482551238u,
+ 141770655u,
+ 3445468037u,
+ 1614807826u,
+ 3110698871u,
+ 809182926u,
+ 2644632325u,
+ 3885131857u,
+ 1278630374u,
+ 3648975313u,
+ 1217833759u,
+ 1509686260u,
+ 2817190507u,
+ 134525747u,
+ 250267852u,
+ 2559105345u,
+ 2416641579u,
+ 426100435u,
+ 486929906u,
+ 241178241u,
+ 3531539379u,
+ 704692991u,
+ 3001633456u,
+ 3990516671u,
+ 2619782509u,
+ 588842726u,
+ 2871949673u,
+ 621390331u,
+ 2304055997u,
+ 3809702625u,
+ 2471383485u,
+ 1630735687u,
+ 2167939898u,
+ 2070992669u,
+ 2826890739u,
+ 1714346061u,
+ 1912761420u,
+ 539780511u,
+ 716119356u,
+ 1342493369u,
+ 1216009367u,
+ 2864243850u,
+ 36288867u,
+ 2981095630u,
+ 2480586007u,
+ 1287539180u,
+ 1804977887u,
+ 2219960896u,
+ 297158412u,
+ 2839013626u,
+ 1971706101u,
+ 3588181149u,
+ 1387242816u,
+ 3713499635u,
+ 3408234160u,
+ 3179393218u,
+ 1359207226u,
+ 3119279997u,
+ 2777679329u,
+ 125221793u,
+ 902631799u,
+ 949389096u,
+ 3415339313u,
+ 4117407143u,
+ 3119227103u,
+ 1787026946u,
+ 3917387257u,
+ 3936044384u,
+ 2242085379u,
+ 1140709958u,
+ 2523265662u,
+ 3627073995u,
+ 3604398568u,
+ 1427913954u,
+ 2465898599u,
+ 3825653050u,
+ 2090876078u,
+ 232270946u,
+ 3116274782u,
+ 1252172657u,
+ 3197497894u,
+ 3983224490u,
+ 1939344836u,
+ 4158531887u,
+ 88050086u,
+ 2343094701u,
+ 1067025562u,
+ 3321491106u,
+ 3772162169u,
+ 909332669u,
+ 1671671873u,
+ 755193996u,
+ 978524521u,
+ 2164582730u,
+ 1757783103u,
+ 3411415001u,
+ 850017018u,
+ 3068762300u,
+ 555996984u,
+ 2404040146u,
+ 3397007611u,
+ 237680219u,
+ 245818821u,
+ 177824968u,
+ 3220945682u,
+ 304446762u,
+ 2267298065u,
+ 1878973555u,
+ 3050739800u,
+ 535731508u,
+ 1160102565u,
+ 4109066907u,
+ 984269821u,
+ 3681788896u,
+ 60254699u,
+ 3890962421u,
+ 2991673698u,
+ 3982271427u,
+ 3514243671u,
+ 1234870914u,
+ 2069958363u,
+ 3867828422u,
+ 1847469687u,
+ 503598128u,
+ 967934988u,
+ 289386211u,
+ 393279961u,
+ 835485527u,
+ 3708682854u,
+ 965218590u,
+ 4020339834u,
+ 2159101708u,
+ 2575134771u,
+ 376656690u,
+ 3499375240u,
+ 3105954900u,
+ 2786692328u,
+ 3458480699u,
+ 1207173847u,
+ 2051152535u,
+ 2738812911u,
+ 2954646330u,
+ 2774866710u,
+ 2162149150u,
+ 3993372257u,
+ 2868120585u,
+ 3086420190u,
+ 3791115537u,
+ 3226697711u,
+ 1818303409u,
+ 4206013897u,
+ 1245186807u,
+ 1680347447u,
+ 684800149u,
+ 2372078492u,
+ 2566952562u,
+ 3310947940u,
+ 3885964747u,
+ 3270357885u,
+ 2098965232u,
+ 609044652u,
+ 434910954u,
+ 93043847u,
+ 805217072u,
+ 883298424u,
+ 3850995479u,
+ 1840717689u,
+ 124278163u,
+ 4250050101u,
+ 2337070911u,
+ 2576763405u,
+ 2518189119u,
+ 3059082421u,
+ 1532107996u,
+ 2920167825u,
+ 2726963926u,
+ 3951524890u,
+ 1272835728u,
+ 1039392592u,
+ 1237920408u,
+ 1996153268u,
+ 647883626u,
+ 4064365193u,
+ 355588474u,
+ 3625797533u,
+ 1209959194u,
+ 503163662u,
+ 530295589u,
+ 1668578780u,
+ 969028048u,
+ 2489337768u,
+ 841218738u,
+ 14126306u,
+ 1854884627u,
+ 3617055808u,
+ 202224793u,
+ 1744552899u,
+ 1559016256u,
+ 3455976027u,
+ 1064269942u,
+ 2990703287u,
+ 1169718685u,
+ 1411804743u,
+ 290849805u,
+ 756035681u,
+ 1505272475u,
+ 1426658932u,
+ 16045749u,
+ 3900455443u,
+ 108521850u,
+ 1009491914u,
+ 3928801938u,
+ 1022079325u,
+ 3076867150u,
+ 4268343543u,
+ 2886814247u,
+ 2005055376u,
+ 1649037732u,
+ 1954533894u,
+ 3779223482u,
+ 1093746989u,
+ 2376482601u,
+ 3561720470u,
+ 1870836501u,
+ 651953759u,
+ 1504660027u,
+ 2097900540u,
+ 2252668945u,
+ 2469849023u,
+ 1986217648u,
+ 2026387757u,
+ 131611273u,
+ 1467981299u,
+ 3440588252u,
+ 1916199579u,
+ 959039804u,
+ 2895114746u,
+ 3292235117u,
+ 649379239u,
+ 28649189u,
+ 3121113086u,
+ 3829761771u,
+ 1675837301u,
+ 1636154723u,
+ 3737794169u,
+ 4082428060u,
+ 1904712095u,
+ 2483810990u,
+ 979972563u,
+ 1269082707u,
+ 370986843u,
+ 1233170438u,
+ 3008501783u,
+ 3905837878u,
+ 1566704758u,
+ 2380919351u,
+ 159980022u,
+ 1334100319u,
+ 2492554074u,
+ 137995234u,
+ 2318192908u,
+ 2608964837u,
+ 1061756617u,
+ 2760140790u,
+ 4069446576u,
+ 1995030350u,
+ 1037005594u,
+ 3489306635u,
+ 1588786838u,
+ 513304862u,
+ 3305490303u,
+ 2264317975u,
+ 3441620307u,
+ 4116970950u,
+ 3121104936u,
+ 1889858928u,
+ 2336693483u,
+ 3906421686u,
+ 2112501080u,
+ 2916376262u,
+ 2244436629u,
+ 663123276u,
+ 774309763u,
+ 258379821u,
+ 3845948150u,
+ 3747409682u,
+ 275936617u,
+ 563064995u,
+ 4049677403u,
+ 2099547498u,
+ 699768412u,
+ 1193153383u,
+ 4289059706u,
+ 3228950241u,
+ 1258043728u,
+ 1334659727u,
+ 3780523664u,
+ 1150773584u,
+ 2509712235u,
+ 2088544320u,
+ 1610096547u,
+ 3486280247u,
+ 1737969289u,
+ 1530372860u,
+ 2563496419u,
+ 2535243890u,
+ 998106254u,
+ 816066803u,
+ 1138534811u,
+ 1405672211u,
+ 2094652173u,
+ 1516292650u,
+ 2618233360u,
+ 3603340340u,
+ 247950637u,
+ 119238855u,
+ 1858201484u,
+ 3459729922u,
+ 157759693u,
+ 8278624u,
+ 3223944237u,
+ 3937209237u,
+ 3820737454u,
+ 839194830u,
+ 2385155004u,
+ 3872251779u,
+ 1375779033u,
+ 2333521764u,
+ 4025446588u,
+ 3839106064u,
+ 374878047u,
+ 1312756310u,
+ 1661068116u,
+ 1321601295u,
+ 4254646350u,
+ 3813168945u,
+ 134103711u,
+ 1535586498u,
+ 82369644u,
+ 411323516u,
+ 761969086u,
+ 819179215u,
+ 582595825u,
+ 3212591411u,
+ 665647256u,
+ 2372804634u,
+ 2378814089u,
+ 801724318u,
+ 658137482u,
+ 2084329677u,
+ 2512952888u,
+ 1573871611u,
+ 570440739u,
+ 3791634131u,
+ 1754412850u,
+ 406040873u,
+ 2576963615u,
+ 535767962u,
+ 1405150444u,
+ 3050488583u,
+ 3870648463u,
+ 2201665400u,
+ 178518008u,
+ 1050761986u,
+ 1635790851u,
+ 2757604743u,
+ 1194306620u,
+ 3895813535u,
+ 259506203u,
+ 1836108753u,
+ 555242075u,
+ 2574778399u,
+ 777988603u,
+ 2306149504u,
+ 2810362568u,
+ 402408487u,
+ 2163697780u,
+ 1982851065u,
+ 153191404u,
+ 1346605886u,
+ 197579289u,
+ 3847665347u,
+ 2437615293u,
+ 819252195u,
+ 3379927756u,
+ 1375088563u,
+ 2650550959u,
+ 2949512074u,
+ 3616578300u,
+ 1616680753u,
+ 1943918335u,
+ 2372676669u,
+ 599487215u,
+ 2422499758u,
+ 3164569986u,
+ 594265585u,
+ 667867933u,
+ 2382753501u,
+ 1213715652u,
+ 1470661916u,
+ 566771851u,
+ 463440918u,
+ 3056034602u,
+ 4101174909u,
+ 130576467u,
+ 2390765932u,
+ 1878895359u,
+ 2047260663u,
+ 3236801323u,
+ 1417182786u,
+ 2650291174u,
+ 541535507u,
+ 2050658788u,
+ 1497955566u,
+ 2322165653u,
+ 2177087336u,
+ 1286897331u,
+ 1168276780u,
+ 2296212785u,
+ 865258239u,
+ 1996766009u,
+ 2012854679u,
+ 1601388981u,
+ 2613134235u,
+ 1657591526u,
+ 2928355430u,
+ 3608354462u,
+ 744304148u,
+ 4205438799u,
+ 3436255438u,
+ 2852837451u,
+ 3546154475u,
+ 2198801660u,
+ 2941229067u,
+ 1725744406u,
+ 1576016233u,
+ 326273484u,
+ 3350602572u,
+ 2525026956u,
+ 529269391u,
+ 742537386u,
+ 966948684u,
+ 4207482684u,
+ 1647708147u,
+ 772473614u,
+ 4100132656u,
+ 2071821864u,
+ 1304991378u,
+ 2104686786u,
+ 494532571u,
+ 1596637043u,
+ 3530310572u,
+ 3844404338u,
+ 311529967u,
+ 2146085784u,
+ 1023590767u,
+ 3264294551u,
+ 1868912500u,
+ 1616049700u,
+ 4044971489u,
+ 226083499u,
+ 2644402452u,
+ 671262u,
+ 3856282165u,
+ 2788249556u,
+ 2975877350u,
+ 3022011519u,
+ 482463024u,
+ 3197313892u,
+ 2458947070u,
+ 213085732u,
+ 3423982376u,
+ 1127434251u,
+ 3003351323u,
+ 3859782824u,
+ 1452447943u,
+ 1377205388u,
+ 294467710u,
+ 4017757977u,
+ 4176004933u,
+ 1973840971u,
+ 1057204069u,
+ 2631053578u,
+ 1518315828u,
+ 1733084351u,
+ 2897935365u,
+ 371135589u,
+ 2166429075u,
+ 1316999184u,
+ 917942378u,
+ 4234919037u,
+ 3994887147u,
+ 202839671u,
+ 2611806597u,
+ 1763402132u,
+ 2528354843u,
+ 2928374144u,
+ 4287461088u,
+ 3374274817u,
+ 2515840515u,
+ 1174711579u,
+ 1526125414u,
+ 1328334421u,
+ 1467789564u,
+ 746112865u,
+ 2522923249u,
+ 2846786366u,
+ 785624778u,
+ 3640382502u,
+ 699425627u,
+ 2333340032u,
+ 879149811u,
+ 1012137370u,
+ 3671295088u,
+ 1115225691u,
+ 2008076767u,
+ 3224593008u,
+ 409074767u,
+ 3405081375u,
+ 1732184447u,
+ 4131742042u,
+ 2887579728u,
+ 411122719u,
+ 49575303u,
+ 2452487329u,
+ 132404436u,
+ 2634269867u,
+ 628865612u,
+ 2089064207u,
+ 3493619675u,
+ 573570698u,
+ 2803401952u,
+ 1846326706u,
+ 2776480783u,
+ 3202282367u,
+ 161406647u,
+ 555882857u,
+ 3002347158u,
+ 3646590134u,
+ 3970439001u,
+ 3593229755u,
+ 589030935u,
+ 1156189491u,
+ 4233262968u,
+ 1884160487u,
+ 1538393768u,
+ 2259575756u,
+ 1419917258u,
+ 658738179u,
+ 2762821193u,
+ 3753817926u,
+ 760570680u,
+ 900223123u,
+ 3199204483u,
+ 3152387802u,
+ 3518662321u,
+ 1138026800u,
+ 4166103824u,
+ 4256962887u,
+ 3860671603u,
+ 2476911454u,
+ 336216996u,
+ 708885235u,
+ 725397672u,
+ 1803116762u,
+ 2785555576u,
+ 101740015u,
+ 4078718445u,
+ 1955237214u,
+ 9650972u,
+ 449296169u,
+ 584729435u,
+ 3295180521u,
+ 589654348u,
+ 4256205129u,
+ 3872811168u,
+ 1159848257u,
+ 3914402308u,
+ 739056677u,
+ 2654817235u,
+ 2975781832u,
+ 2945335776u,
+ 2792662538u,
+ 4124362519u,
+ 1578034244u,
+ 347127450u,
+ 818851140u,
+ 2127100315u,
+ 2486499071u,
+ 4198130806u,
+ 1869105609u,
+ 1961961717u,
+ 1651285423u,
+ 376774848u,
+ 2681263019u,
+ 1185959234u,
+ 1674813864u,
+ 32812913u,
+ 3511671436u,
+ 3250344299u,
+ 2961919237u,
+ 722029715u,
+ 3677835234u,
+ 3534013806u,
+ 2896926420u,
+ 2405611392u,
+ 1523923100u,
+ 538451356u,
+ 2872548905u,
+ 3122230170u,
+ 337087364u,
+ 2659340735u,
+ 3849128055u,
+ 556114376u,
+ 1997152544u,
+ 3761450839u,
+ 3143779940u,
+ 3256759779u,
+ 2844565122u,
+ 228442897u,
+ 3589092287u,
+ 786119294u,
+ 4089515771u,
+ 3720982051u,
+ 1236422652u,
+ 2002271241u,
+ 98809947u,
+ 1925281885u,
+ 3856119646u,
+ 3522402037u,
+ 2119723860u,
+ 3500067577u,
+ 3688915105u,
+ 443441159u,
+ 1795715271u,
+ 2772968214u,
+ 921416086u,
+ 4274010930u,
+ 3123194886u,
+ 4156595625u,
+ 2153773382u,
+ 1880645824u,
+ 1783695477u,
+ 2639075904u,
+ 2369609874u,
+ 2020298024u,
+ 3035677150u,
+ 20152938u,
+ 3700162244u,
+ 2301383878u,
+ 704787941u,
+ 1912605772u,
+ 801557569u,
+ 3080244537u,
+ 2116665331u,
+ 2452111071u,
+ 3506260614u,
+ 862540580u,
+ 1275699972u,
+ 66210903u,
+ 106773917u,
+ 3693457478u,
+ 2402783622u,
+ 1239121180u,
+ 676003037u,
+ 2603048829u,
+ 1725001637u,
+ 1220274379u,
+ 24507488u,
+ 903764486u,
+ 4189545897u,
+ 1702746631u,
+ 3218068652u,
+ 3306659191u,
+ 790973134u,
+ 1265526960u,
+ 3431804268u,
+ 3325211765u,
+ 3605213000u,
+ 2877687268u,
+ 2252987926u,
+ 2380945092u,
+ 858624424u,
+ 1002964636u,
+ 1862801950u,
+ 1624111941u,
+ 2506763607u,
+ 760658520u,
+ 2734479345u,
+ 3411969548u,
+ 771362694u,
+ 3655222003u,
+ 2713412965u,
+ 2617767046u,
+ 1779451182u,
+ 3696950253u,
+ 1494085808u,
+ 1423735456u,
+ 800705781u,
+ 3797847307u,
+ 3518984231u,
+ 196474988u,
+ 1813335502u,
+ 2243046583u,
+ 2578707704u,
+ 2592488572u,
+ 4085007200u,
+ 3609770110u,
+ 2731535571u,
+ 3190540952u,
+ 1865257805u,
+ 1804143221u,
+ 3166875197u,
+ 1184225570u,
+ 2013135819u,
+ 3678444101u,
+ 2569887572u,
+ 3559018477u,
+ 3823772506u,
+ 1537738480u,
+ 713705243u,
+ 792081862u,
+ 1581340885u,
+ 3140030205u,
+ 3435723625u,
+ 3093218524u,
+ 3683643763u,
+ 753869336u,
+ 590258834u,
+ 608176704u,
+ 180732483u,
+ 31365344u,
+ 29753898u,
+ 2899243456u,
+ 1020423361u,
+ 152655309u,
+ 3809554076u,
+ 2069071231u,
+ 4000441303u,
+ 3046501174u,
+ 1897816893u,
+ 1610689080u,
+ 2580357110u,
+ 255270539u,
+ 3363490012u,
+ 3711397066u,
+ 3983751767u,
+ 1725231855u,
+ 172296475u,
+ 2179003295u,
+ 660196982u,
+ 526538193u,
+ 2137670317u,
+ 2219075701u,
+ 1987239722u,
+ 856404486u,
+ 2976933454u,
+ 3678014122u,
+ 2713682703u,
+ 3329090001u,
+ 2248358519u,
+ 3254616418u,
+ 1747030903u,
+ 1620566606u,
+ 880370315u,
+ 2337236788u,
+ 2883145755u
+ };
+ const int n = 768;
+ unsigned b[n] = {0};
+ unsigned v[] = {3, 5, 7};
+ const int size = sizeof(v)/sizeof(v[0]);
+ std::seed_seq s(v, v + size);
+ s.generate(b, b + n);
+ for (int i = 0; i < n; ++i)
+ assert(a[i] == b[i]);
+ }
+}
diff --git a/test/std/numerics/rand/rand.util/rand.util.seedseq/initializer_list.pass.cpp b/test/std/numerics/rand/rand.util/rand.util.seedseq/initializer_list.pass.cpp
new file mode 100644
index 000000000000..d4ee9c14d528
--- /dev/null
+++ b/test/std/numerics/rand/rand.util/rand.util.seedseq/initializer_list.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class seed_seq;
+
+// template<class T>
+// seed_seq(initializer_list<T> il);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ std::seed_seq s= {5, 4, 3, 2, 1};
+ assert(s.size() == 5);
+ unsigned b[5] = {0};
+ s.param(b);
+ assert(b[0] == 5);
+ assert(b[1] == 4);
+ assert(b[2] == 3);
+ assert(b[3] == 2);
+ assert(b[4] == 1);
+#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}
diff --git a/test/std/numerics/rand/rand.util/rand.util.seedseq/iterator.pass.cpp b/test/std/numerics/rand/rand.util/rand.util.seedseq/iterator.pass.cpp
new file mode 100644
index 000000000000..2214dca8aea8
--- /dev/null
+++ b/test/std/numerics/rand/rand.util/rand.util.seedseq/iterator.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class seed_seq;
+
+// template<class InputIterator>
+// seed_seq(InputIterator begin, InputIterator end);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ unsigned a[5] = {5, 4, 3, 2, 1};
+ std::seed_seq s(a, a+5);
+ assert(s.size() == 5);
+ unsigned b[5] = {0};
+ s.param(b);
+ assert(b[0] == 5);
+ assert(b[1] == 4);
+ assert(b[2] == 3);
+ assert(b[3] == 2);
+ assert(b[4] == 1);
+}
diff --git a/test/std/numerics/rand/rand.util/rand.util.seedseq/types.pass.cpp b/test/std/numerics/rand/rand.util/rand.util.seedseq/types.pass.cpp
new file mode 100644
index 000000000000..430d9b781d2b
--- /dev/null
+++ b/test/std/numerics/rand/rand.util/rand.util.seedseq/types.pass.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class seed_seq
+// {
+// public:
+// // types
+// typedef uint_least32_t result_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ static_assert((std::is_same<std::seed_seq::result_type, std::uint_least32_t>::value), "");
+}