]>
Commit | Line | Data |
---|---|---|
be58e01d | 1 | // { dg-do run { target c++11 } } |
434a8652 | 2 | // { dg-require-cstdint "" } |
3 | // | |
4 | // 2014-08-09 Ulrich Drepper <drepper@gmail.com> | |
5 | // | |
fbd26352 | 6 | // Copyright (C) 2014-2019 Free Software Foundation, Inc. |
434a8652 | 7 | // |
8 | // This file is part of the GNU ISO C++ Library. This library is free | |
9 | // software; you can redistribute it and/or modify it under the | |
10 | // terms of the GNU General Public License as published by the | |
11 | // Free Software Foundation; either version 3, or (at your option) | |
12 | // any later version. | |
13 | // | |
14 | // This library is distributed in the hope that it will be useful, | |
15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | // GNU General Public License for more details. | |
18 | // | |
19 | // You should have received a copy of the GNU General Public License along | |
20 | // with this library; see the file COPYING3. If not see | |
21 | // <http://www.gnu.org/licenses/>. | |
22 | ||
2e8e2399 | 23 | // Class template uniform_on_sphere_distribution |
24 | // 26.5.1.6 Random number distribution requirements [rand.req.dist] | |
434a8652 | 25 | |
26 | #include <ext/random> | |
27 | #include <sstream> | |
28 | #include <testsuite_hooks.h> | |
29 | ||
30 | void | |
31 | test01() | |
32 | { | |
434a8652 | 33 | std::minstd_rand0 rng; |
34 | ||
35 | __gnu_cxx::uniform_on_sphere_distribution<3> u3; | |
36 | ||
37 | for (size_t n = 0; n < 1000; ++n) | |
38 | { | |
39 | auto r = u3(rng); | |
40 | ||
41 | VERIFY (r[0] != 0.0 || r[1] != 0.0 || r[2] != 0.0); | |
42 | } | |
43 | ||
44 | __gnu_cxx::uniform_on_sphere_distribution<2> u2; | |
45 | ||
46 | for (size_t n = 0; n < 1000; ++n) | |
47 | { | |
48 | auto r = u2(rng); | |
49 | ||
50 | VERIFY (r[0] != 0.0 || r[1] != 0.0); | |
51 | } | |
52 | } | |
53 | ||
54 | int | |
55 | main() | |
56 | { | |
57 | test01(); | |
58 | return 0; | |
59 | } |