39#ifndef BLOCXX_SECURE_RAND_HPP_INCLUDE_GUARD_
40#define BLOCXX_SECURE_RAND_HPP_INCLUDE_GUARD_
43#include "blocxx/BLOCXX_config.h"
45#ifdef BLOCXX_HAVE_OPENSSL
64 template <
typename T>
struct assert_unsigned_integer_type;
66 template <>
struct assert_unsigned_integer_type<unsigned char> { };
67 template <>
struct assert_unsigned_integer_type<unsigned short> { };
68 template <>
struct assert_unsigned_integer_type<unsigned int> { };
69 template <>
struct assert_unsigned_integer_type<unsigned long> { };
70 template <>
struct assert_unsigned_integer_type<unsigned long long> { };
74 template <
typename T>
struct assert_integer_type;
76 template <>
struct assert_integer_type<char> { };
78 template <>
struct assert_integer_type<signed char> { };
79 template <>
struct assert_integer_type<short> { };
80 template <>
struct assert_integer_type<int> { };
81 template <>
struct assert_integer_type<long> { };
82 template <>
struct assert_integer_type<long long> { };
84 template <>
struct assert_integer_type<unsigned char> { };
85 template <>
struct assert_integer_type<unsigned short> { };
86 template <>
struct assert_integer_type<unsigned int> { };
87 template <>
struct assert_integer_type<unsigned long> { };
88 template <>
struct assert_integer_type<unsigned long long> { };
92 template <
typename T>
struct assert_float_type;
94 template <>
struct assert_float_type<float> { };
95 template <>
struct assert_float_type<double> { };
96 template <>
struct assert_float_type<long double> { };
98 template <
typename Un
signedInt>
99 UnsignedInt rand_uint_lt(UnsignedInt n);
101 template <
typename Integer>
102 Integer rand_range(Integer min_value, Integer max_value);
104 template <
typename Real>
105 Real rand_unit_interval();
137 template <
typename Un
signedInt>
140 Impl::assert_unsigned_integer_type<UnsignedInt> dummy;
142 rand(
reinterpret_cast<unsigned char *
>(&
n),
sizeof(
n));
155 template <
typename Un
signedInt>
158 Impl::assert_unsigned_integer_type<UnsignedInt> dummy;
159 return Impl::rand_uint_lt(
n);
172 template <
typename Integer>
175 Impl::assert_integer_type<Integer> dummy;
188 template <
typename Real>
191 Impl::assert_float_type<Real> dummy;
192 return Impl::rand_unit_interval<Real>();
#define BLOCXX_DECLARE_EXCEPTION(NAME)
Declare a new exception class named <NAME>Exception that derives from Exception This macro is typical...
bool operator==(const Array< T > &x, const Array< T > &y)