5 #if __has_include(<experimental/random>)
6 #include <experimental/random>
12 #include <boost/config.hpp>
16 using s_t
= decltype(s_
);
19 auto constexpr min
= std::numeric_limits
<s_t
>::min();
20 auto constexpr max
= std::numeric_limits
<s_t
>::max();
21 s_
= std::experimental::randint(min
, max
);
23 std::random_device rd
;
24 std::uniform_int_distribution
<s_t
> uni_dist
;
28 auto resp
{b32_ndigits_
};
29 b32_str_
[resp
] = '\0';
31 // <http://philzimmermann.com/docs/human-oriented-base-32-encoding.txt>
33 constexpr char b32_charset
[]{"ybndrfg8ejkmcpqxot1uwisza345h769"};
35 auto const os
{reinterpret_cast<const unsigned char*>(&s_
)};
36 auto osp
{os
+ sizeof(s_
)};
39 switch ((osp
- os
) % 5) { // Duff's device
43 b32_str_
[--resp
] = b32_charset
[x
% 32];
48 x
|= (static_cast<unsigned long>(*--osp
)) << 3;
49 b32_str_
[--resp
] = b32_charset
[x
% 32];
51 b32_str_
[--resp
] = b32_charset
[x
% 32];
56 x
|= (static_cast<unsigned long>(*--osp
)) << 1;
57 b32_str_
[--resp
] = b32_charset
[x
% 32];
62 x
|= (static_cast<unsigned long>(*--osp
)) << 4;
63 b32_str_
[--resp
] = b32_charset
[x
% 32];
65 b32_str_
[--resp
] = b32_charset
[x
% 32];
70 x
|= (static_cast<unsigned long>(*--osp
)) << 2;
71 b32_str_
[--resp
] = b32_charset
[x
% 32];
73 b32_str_
[--resp
] = b32_charset
[x
];