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: no-random-device |
10 | |
11 | // <random> |
12 | |
13 | // class random_device; |
14 | |
15 | // double entropy() const; |
16 | |
17 | #include <random> |
18 | #include <cassert> |
19 | #include <climits> |
20 | |
21 | #include "test_macros.h" |
22 | |
23 | int main(int, char**) { |
24 | std::random_device r; |
25 | double e = r.entropy(); |
26 | assert(e >= 0); |
27 | assert(e <= sizeof(typename std::random_device::result_type) * CHAR_BIT); |
28 | |
29 | return 0; |
30 | } |
31 | |