-
Notifications
You must be signed in to change notification settings - Fork 52
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
Fix builder to use provided rng #150
Conversation
This commit fixes the turmoil sim builder by removing the `rng` function. Currently the `build` function ignores the `rng` set on the builder, and due to the boxing of the value there is no easy way to repeatedly build a sim with the same `rng`. We would need to add the ability to clone the boxed rng, which requires some complicated trait bounds and a different breaking of the interface. This is simpler and fixes the bug where rng was ignored during building. This is a breaking change: - `rng` is removed from the builder, as it was not delivering its expected behaviour. Users now need to explicitly specify `build_with_rng`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved with one minor doc nit.
pub fn build_with_rng<'a>(&self, rng: Box<dyn RngCore>) -> Sim<'a> { | ||
/// Build a sim with a provided `rng`. | ||
/// | ||
/// This allows setting the random number generator used to fuzz |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// This allows setting the random number generator used to fuzz | |
/// This allows setting the random number generator used to fuzz. |
/// Build a sim with a provided `rng`. | ||
/// | ||
/// This allows setting the random number generator used to fuzz | ||
fn build_with_rng<'a>(&self, rng: Box<dyn RngCore>) -> Sim<'a> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, just so you know, the function was public before and isn't anymore, is that by design?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this was a mistake. It should be fixed after #152 is merged
Add documentation to the sim builder and the config, particularly focused on default values. Also fix a few errors that emerged from running `cargo doc`, and make `build_with_rng` public again (mistake in #150).
This commit fixes the turmoil sim builder by removing the
rng
function. Currently the
build
function ignores therng
set on thebuilder, and due to the boxing of the value there is no easy way to
repeatedly build a sim with the same
rng
. We would need to add theability to clone the boxed rng, which requires some complicated trait
bounds and a different breaking of the interface. This is simpler and
fixes the bug where rng was ignored during building.
This is a breaking change:
rng
is removed from the builder, as it was not delivering itsexpected behaviour. Users now need to explicitly specify
build_with_rng
.