1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: no-random-device
13 // class random_device;
15 // result_type operator()();
20 #include <system_error>
22 #include "test_macros.h"
28 std::random_device::result_type e
= r();
29 ((void)e
); // Prevent unused warning
32 // When using the `/dev/urandom` implementation, make sure that we throw
33 // an exception when we hit EOF while reading the custom-provided file.
34 #if !defined(TEST_HAS_NO_EXCEPTIONS) && defined(_LIBCPP_USING_DEV_RANDOM)
36 std::random_device
r("/dev/null");
40 } catch (const std::system_error
&) {