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 //===----------------------------------------------------------------------===// 8 9 #ifndef _LIBCPP___RANDOM_UNIFORM_RANDOM_BIT_GENERATOR_H 10 #define _LIBCPP___RANDOM_UNIFORM_RANDOM_BIT_GENERATOR_H 11 12 #include <__concepts/arithmetic.h> 13 #include <__concepts/invocable.h> 14 #include <__concepts/same_as.h> 15 #include <__config> 16 #include <type_traits> 17 18 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 19 # pragma GCC system_header 20 #endif 21 22 _LIBCPP_PUSH_MACROS 23 #include <__undef_macros> 24 25 _LIBCPP_BEGIN_NAMESPACE_STD 26 27 #if _LIBCPP_STD_VER > 17 28 29 // [rand.req.urng] 30 template<class _Gen> 31 concept uniform_random_bit_generator = 32 invocable<_Gen&> && unsigned_integral<invoke_result_t<_Gen&>> && 33 requires { 34 { _Gen::min() } -> same_as<invoke_result_t<_Gen&>>; 35 { _Gen::max() } -> same_as<invoke_result_t<_Gen&>>; 36 requires bool_constant<(_Gen::min() < _Gen::max())>::value; 37 }; 38 39 #endif // _LIBCPP_STD_VER > 17 40 41 _LIBCPP_END_NAMESPACE_STD 42 43 _LIBCPP_POP_MACROS 44 45 #endif // _LIBCPP___RANDOM_UNIFORM_RANDOM_BIT_GENERATOR_H 46