2010-05-19 01:53:57 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2010-11-16 22:09:02 +00:00
|
|
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
|
|
// Source Licenses. See LICENSE.TXT for details.
|
2010-05-19 01:53:57 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
// <random>
|
|
|
|
|
|
|
|
// template<class IntType = int>
|
|
|
|
// class discrete_distribution
|
|
|
|
|
|
|
|
// discrete_distribution(initializer_list<double> wl);
|
|
|
|
|
|
|
|
#include <random>
|
|
|
|
#include <cassert>
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
2011-08-12 21:56:02 +00:00
|
|
|
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
2010-05-19 01:53:57 +00:00
|
|
|
{
|
|
|
|
typedef std::discrete_distribution<> D;
|
2011-08-12 21:56:02 +00:00
|
|
|
D d = {1., 2.};
|
2010-05-19 01:53:57 +00:00
|
|
|
std::vector<double> p = d.probabilities();
|
2011-08-12 21:56:02 +00:00
|
|
|
assert(p.size() == 2);
|
2010-05-19 01:53:57 +00:00
|
|
|
assert(p[0] == 1);
|
2011-08-12 21:56:02 +00:00
|
|
|
assert(p[1] == 2);
|
2010-05-19 01:53:57 +00:00
|
|
|
}
|
2011-08-12 21:56:02 +00:00
|
|
|
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
2010-05-19 01:53:57 +00:00
|
|
|
}
|