File indexing completed on 2026-05-03 08:13:39
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef _LIBCPP___CXX03___RANDOM_RANDOM_DEVICE_H
0010 #define _LIBCPP___CXX03___RANDOM_RANDOM_DEVICE_H
0011
0012 #include <__cxx03/__config>
0013 #include <__cxx03/string>
0014
0015 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0016 # pragma GCC system_header
0017 #endif
0018
0019 _LIBCPP_PUSH_MACROS
0020 #include <__cxx03/__undef_macros>
0021
0022 _LIBCPP_BEGIN_NAMESPACE_STD
0023
0024 #if !defined(_LIBCPP_HAS_NO_RANDOM_DEVICE)
0025
0026 class _LIBCPP_EXPORTED_FROM_ABI random_device {
0027 # ifdef _LIBCPP_USING_DEV_RANDOM
0028 int __f_;
0029 # elif !defined(_LIBCPP_ABI_NO_RANDOM_DEVICE_COMPATIBILITY_LAYOUT)
0030 _LIBCPP_DIAGNOSTIC_PUSH
0031 _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wunused-private-field")
0032
0033
0034
0035
0036 # if defined(__APPLE__)
0037 int __padding_;
0038 # endif
0039
0040
0041
0042 _LIBCPP_DIAGNOSTIC_POP
0043 # endif
0044
0045 public:
0046
0047 typedef unsigned result_type;
0048
0049
0050 static _LIBCPP_CONSTEXPR const result_type _Min = 0;
0051 static _LIBCPP_CONSTEXPR const result_type _Max = 0xFFFFFFFFu;
0052
0053 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
0054 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
0055
0056
0057 # ifndef _LIBCPP_CXX03_LANG
0058 _LIBCPP_HIDE_FROM_ABI random_device() : random_device("/dev/urandom") {}
0059 explicit random_device(const string& __token);
0060 # else
0061 explicit random_device(const string& __token = "/dev/urandom");
0062 # endif
0063 ~random_device();
0064
0065
0066 result_type operator()();
0067
0068
0069 double entropy() const _NOEXCEPT;
0070
0071 random_device(const random_device&) = delete;
0072 void operator=(const random_device&) = delete;
0073 };
0074
0075 #endif
0076
0077 _LIBCPP_END_NAMESPACE_STD
0078
0079 _LIBCPP_POP_MACROS
0080
0081 #endif