Skip to content

Commit

Permalink
use the power generator number half of time we need a large number
Browse files Browse the repository at this point in the history
  • Loading branch information
ggrieco-tob committed Jan 24, 2023
1 parent 6ca5396 commit 359e069
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Echidna/ABI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ getRandomPow n = if n <= 0 then return 0 else
getRandomR (2 ^ (mexp `div` 2), 2 ^ mexp)

getRandomUint :: MonadRandom m => Int -> m Integer
getRandomUint n = join $ R.fromList [(getRandomR (0, 1023), 1), (getRandomPow (n - 5), 8), (getRandomR (2 ^ n - 5, 2 ^ n - 1), 1)]
getRandomUint n = join $ R.fromList [(getRandomR (0, 1023), 1), (getRandomR (0, 2 ^ n - 5), 4), (getRandomPow (n - 5), 4), (getRandomR (2 ^ n - 5, 2 ^ n - 1), 1)]

getRandomInt :: MonadRandom m => Int -> m Integer
getRandomInt n = join $ R.fromList [(getRandomR (-1023, 1023), 1), (getRandomR (-1 * 2 ^ n, 2 ^ (n - 1)), 9)]
Expand Down

0 comments on commit 359e069

Please sign in to comment.