-
Notifications
You must be signed in to change notification settings - Fork 705
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
Refactor sampler seeding #2456
Refactor sampler seeding #2456
Conversation
&uniformReplacer{ | ||
rng: globalRNG, | ||
}, | ||
&uniformResample{ | ||
rng: globalRNG, |
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.
nit: should we use the NewUniform constructor here?
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.
I think that would be pretty hard to understand which concrete type we are checking for (considering both of these structs are uniform samplers).
@@ -26,29 +26,28 @@ func TestDualAlphaOptimization(t *testing.T) { | |||
BetaVirtuous: 15, | |||
BetaRogue: 20, | |||
} | |||
seed uint64 = 0 | |||
seed uint64 = 0 | |||
source = prng.NewMT19937() |
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.
q: should we encapsulate this within a rand.DefaultSource getter? Admittedly it'd be another global, but maybe it'd help clients select the right source of randomness?
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.
I don't think we really care too much about the actual randomness used... just that it is deterministic. I don't really seen the benefit in adding a helper here.
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.
just a couple of nits
Why this should be merged
How this works
Rather than creating a sampler and then seeding it - we allow a custom source of RNG (which can already be seeded).
How this was tested