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 | // <random> |
10 | |
11 | // template<class RealType = double> |
12 | // class lognormal_distribution |
13 | |
14 | // template<class _URNG> result_type operator()(_URNG& g, const param_type& parm); |
15 | // https://llvm.org/PR52906 |
16 | |
17 | #include <random> |
18 | #include <cassert> |
19 | |
20 | #include "test_macros.h" |
21 | |
22 | int main(int, char**) |
23 | { |
24 | typedef std::lognormal_distribution<> D; |
25 | typedef D::param_type P; |
26 | typedef std::mt19937 G; |
27 | G g; |
28 | D d; |
29 | |
30 | const P p1 = d.param(); |
31 | const P p2 = d.param(); |
32 | assert(p1 == p2); |
33 | (void) d(g, p1); // This line must not modify p1. |
34 | assert(p1 == p2); |
35 | LIBCPP_ASSERT(p1 == d.param()); |
36 | |
37 | return 0; |
38 | } |
39 | |