Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / test / std / numerics / rand / rand.device / entropy.pass.cpp
blob39fbfe838077c76428f97289337b9092c04e072a
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 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: no-random-device
11 // <random>
13 // class random_device;
15 // double entropy() const;
17 #include <random>
18 #include <cassert>
19 #include <climits>
21 #include "test_macros.h"
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);
29 return 0;