Summary
Trident uses fair random generator which is not a good solution for fuzzing toolkit
For example, the following assert did not reverted for over 100B executions
#[flow]
fn flow1(&mut self) {
let a = self.trident.random_from_range(0..u64::MAX) as u128;
let b = self.trident.random_from_range(0..u64::MAX) as u128;
let c = self.trident.random_from_range(0..u64::MAX) as u128;
assert!(a * b > c);
}
Basic Example
Unfair random based on various byte sequences can be used
// Funny sample of unfair random breaking the assert above
fn unfair_u64(&mut self) -> u64 {
let pow = self.trident.random_from_range(7..71);
let divisor = self.trident.random_from_range(131..247);
return (2u128.pow(pow) / divisor) as u64;
}
Drawbacks
Good unfair random is a way more complex than the fair one, it is usually statefull which takes additional computation resources
Unresolved questions
No response
Implementation PR
No response
Reference Issues
No response
Summary
Trident uses fair random generator which is not a good solution for fuzzing toolkit
For example, the following assert did not reverted for over 100B executions
Basic Example
Unfair random based on various byte sequences can be used
Drawbacks
Good unfair random is a way more complex than the fair one, it is usually statefull which takes additional computation resources
Unresolved questions
No response
Implementation PR
No response
Reference Issues
No response