AP_Logger: fix MAVLink logger random failure on SITL

rand() return an int
This commit is contained in:
Pierre Kancir 2021-08-11 10:37:26 +02:00 committed by Peter Barker
parent 8216905f47
commit 99456ba1f8

View File

@ -560,7 +560,7 @@ bool AP_Logger_MAVLink::send_log_block(struct dm_block &block)
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
// deliberately fail 10% of the time in SITL:
if (rand() < 0.1) {
if ((rand() % 100 + 1) < 10) {
return false;
}
#endif