diff --git a/port/android/ipadapter.c b/port/android/ipadapter.c index e47c176a1..b910f90b0 100644 --- a/port/android/ipadapter.c +++ b/port/android/ipadapter.c @@ -815,7 +815,7 @@ static int pick_random_fd(const fd_set *sourcefds, int fd_count, int max_fd) { assert(fd_count > 0); - int random_rfd = (int)oc_random_value() % fd_count; + int random_rfd = (int)(oc_random_value() % fd_count); for (int i = 0; i <= max_fd; i++) { if (FD_ISSET(i, sourcefds)) { if (--fd_count == random_rfd) { diff --git a/port/esp32/adapter/src/ipadapter.c b/port/esp32/adapter/src/ipadapter.c index 40cb2a463..c7f52d64d 100644 --- a/port/esp32/adapter/src/ipadapter.c +++ b/port/esp32/adapter/src/ipadapter.c @@ -840,7 +840,7 @@ static int pick_random_fd(const fd_set *sourcefds, int fd_count, int max_fd) { assert(fd_count > 0); - int random_rfd = (int)oc_random_value() % fd_count; + int random_rfd = (int)(oc_random_value() % fd_count); for (int i = 0; i <= max_fd; i++) { if (FD_ISSET(i, sourcefds)) { if (--fd_count == random_rfd) { diff --git a/port/linux/ipadapter.c b/port/linux/ipadapter.c index 1ed0a2a94..d0831f154 100644 --- a/port/linux/ipadapter.c +++ b/port/linux/ipadapter.c @@ -937,7 +937,7 @@ static int pick_random_fd(const fd_set *sourcefds, int fd_count, int max_fd) { assert(fd_count > 0); - int random_rfd = (int)oc_random_value() % fd_count; + int random_rfd = (int)(oc_random_value() % fd_count); for (int i = 0; i <= max_fd; i++) { if (FD_ISSET(i, sourcefds)) { if (--fd_count == random_rfd) {