1 //===-------------------------- random.cpp --------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 #include "system_error"
14 #define rename solaris_headers_are_broken
20 _LIBCPP_BEGIN_NAMESPACE_STD
22 random_device::random_device(const string& __token)
23 : __f_(open(__token.c_str(), O_RDONLY))
26 __throw_system_error(errno, ("random_device failed to open " + __token).c_str());
29 random_device::~random_device()
35 random_device::operator()()
38 read(__f_, &r, sizeof(r));
43 random_device::entropy() const _NOEXCEPT
48 _LIBCPP_END_NAMESPACE_STD