Debian Codegraph @

libcxx/test/std/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.discrete/param_ctor_default.pass.cpp

raw
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8
9 // UNSUPPORTED: c++03
10
11 // <random>
12
13 // template<class IntType = int>
14 // class discrete_distribution
15
16 // param_type(initializer_list<double> wl);
17
18 #include <random>
19
20 #include <cassert>
21 #include <vector>
22
23 #include "test_macros.h"
24
25 int main(int, char**)
26 {
27 {
28 typedef std::discrete_distribution<> D;
29 typedef D::param_type P;
30 P pa = {1};
31 std::vector<double> p = pa.probabilities();
32 assert(p.size() == 1);
33 assert(p[0] == 1);
34 }
35
36 return 0;
37 }