Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues to combine Arbitrary and ForcedRng #164

Open
shaobo-he-aws opened this issue Jul 15, 2023 · 0 comments
Open

Issues to combine Arbitrary and ForcedRng #164

shaobo-he-aws opened this issue Jul 15, 2023 · 0 comments

Comments

@shaobo-he-aws
Copy link

It seems there will be a lot of wasted cycles when we use ArbitraryGenerator and ForcedRng. IIUC, ForcedRng will be called again if the generation function returns a None, which seems to me is under the assumption that generation failures result from insufficient random bytes. This assumption may not hold for users of the Arbitrary crate. For example, if we want to generate values under certain constraints using the arbitrary trait method, one strategy is to generate a weaker value and return an Err if that value doesn't satisfy the constraints. The rationale is that the fuzzer should keep the values satisfying the constraints as they lead to deeper code coverage. In other words, we save the trouble of generating values guaranteed to satisfy the constraints. So, let's say we adopt the strategy and then ForcedRng's generate_from_bytes method will be called again and again until the number of bytes generated is above the upper bound specified by the argument, which could be unbounded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant