diff options
author | van Hauser <vh@thc.org> | 2020-08-31 10:57:01 +0200 |
---|---|---|
committer | van Hauser <vh@thc.org> | 2020-08-31 10:57:01 +0200 |
commit | 4566bcf122c251c023abce0683666921bd4df755 (patch) | |
tree | 2c8897ddf6d7e3b883e539dd49cddd9b00fd48de /include/afl-fuzz.h | |
parent | ca0105ddf6bd3c28a7ea4f9a963f820b1eb55ac6 (diff) | |
download | afl++-4566bcf122c251c023abce0683666921bd4df755.tar.gz |
code-format
Diffstat (limited to 'include/afl-fuzz.h')
-rw-r--r-- | include/afl-fuzz.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/include/afl-fuzz.h b/include/afl-fuzz.h index c5b01da8..97e60347 100644 --- a/include/afl-fuzz.h +++ b/include/afl-fuzz.h @@ -1027,11 +1027,15 @@ static inline u32 rand_below(afl_state_t *afl, u32 limit) { } - /* Modulo is biased - we don't want our fuzzing to be biased so let's do it right. */ - u64 unbiased_rnd; + /* Modulo is biased - we don't want our fuzzing to be biased so let's do it + * right. */ + u64 unbiased_rnd; do { + unbiased_rnd = rand_next(afl); + } while (unlikely(unbiased_rnd >= (UINT64_MAX - (UINT64_MAX % limit)))); + return unbiased_rnd % limit; } |