blob: 72aff076a5df250681c9e751fbb53b72f9c134df [file] [log] [blame]
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
Howard Hinnantf5256e12010-05-11 21:36:01 +00003// The LLVM Compiler Infrastructure
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00004//
Howard Hinnantb64f8b02010-11-16 22:09:02 +00005// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00007//
8//===----------------------------------------------------------------------===//
9
10// <random>
11
12// class random_device;
13
14// result_type operator()();
15
16#include <random>
17#include <cassert>
18
19int main()
20{
David Majnemer4d9f97b2014-06-03 02:40:39 +000021 {
22 std::random_device r;
23 std::random_device::result_type e = r();
24 }
25
26 try
27 {
28 std::random_device r("/dev/null");
29 r();
30 assert(false);
31 }
Dan Albert1d4a1ed2016-05-25 22:36:09 -070032 catch (const std::system_error& e)
David Majnemer4d9f97b2014-06-03 02:40:39 +000033 {
34 }
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000035}