diff options
author | van Hauser <vh@thc.org> | 2020-10-12 11:12:16 +0200 |
---|---|---|
committer | van Hauser <vh@thc.org> | 2020-10-12 11:12:16 +0200 |
commit | d9b63766dfdb8feeb1dc6f7c51c17abf07ee4086 (patch) | |
tree | ea02a1c1423c681e0aedfda2ecc326e5b1c97ec8 /src/afl-performance.c | |
parent | 5427f7ca981a537f14f842a98d5981463efe8c5b (diff) | |
download | afl++-d9b63766dfdb8feeb1dc6f7c51c17abf07ee4086.tar.gz |
fix new seed selection algo
Diffstat (limited to 'src/afl-performance.c')
-rw-r--r-- | src/afl-performance.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/afl-performance.c b/src/afl-performance.c index 7a80ac4b..6fa95dea 100644 --- a/src/afl-performance.c +++ b/src/afl-performance.c @@ -47,7 +47,7 @@ void rand_set_seed(afl_state_t *afl, s64 init_seed) { } -uint64_t rand_next(afl_state_t *afl) { +inline uint64_t rand_next(afl_state_t *afl) { const uint64_t result = rotl(afl->rand_seed[0] + afl->rand_seed[3], 23) + afl->rand_seed[0]; @@ -67,6 +67,14 @@ uint64_t rand_next(afl_state_t *afl) { } +/* returns a double between 0.000000000 and 1.000000000 */ + +inline double rand_next_percent(afl_state_t *afl) { + + return (double)(((double)rand_next(afl)) / (double) 0xffffffffffffffff); + +} + /* This is the jump function for the generator. It is equivalent to 2^128 calls to rand_next(); it can be used to generate 2^128 non-overlapping subsequences for parallel computations. */ |