Skip to content

Commit 1e77752

Browse files
committed
c++ compat: standard says only specific integral types are supported by uniform_int_distribution, causing issues with older libc++
1 parent cfd260b commit 1e77752

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/lib/random.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ string random_socket_or_port_flag(const string &binary) {
5050
}
5151

5252
char random_ascii(char min, char max) {
53-
return static_cast<char>(random_num(min, max));
53+
return static_cast<char>(random_num(int(min), int(max)));
5454
}
5555

5656
string random_ascii_string(size_t len, char min, char max) {
@@ -77,7 +77,7 @@ pair<string, string> random_ascii_pair(size_t minlen, size_t maxlen) {
7777
#include <climits>
7878

7979
char random_binary() {
80-
return random_num(CHAR_MIN, CHAR_MAX);
80+
return random_num(int(CHAR_MIN), int(CHAR_MAX));
8181
}
8282

8383
string random_binary_string(size_t len) {

0 commit comments

Comments
 (0)