-
Notifications
You must be signed in to change notification settings - Fork 2
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
Implement Uniform and UniformRange #14
Implement Uniform and UniformRange #14
Conversation
This PR implements suggestion from here: #8 (comment) |
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 like changes but didn't pay much attention to changes to Random
|
||
class UniformRange a where | ||
uniformR :: MonadRandom g m => (a, a) -> g -> m 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.
Here we have question of semantics. What should uniformR (a,b)
do for a > b
? random
's position is that it's unspecified. mwc-random
made choice uniformR (a,b) = uniformR (b,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.
I think that is a fine choice. It is definitely better than throwing an error. We could of course return a Maybe
, but for consistency sake with other libraries and current randomR
I think: uniformR (a,b) = uniformR (b,a)
is the right way to go.
I am glad you like that changes, I am onboard with this as well. Merging, if any changes are necessary we can handle em in the bigger PR. It sound like a problem in #8 is solved too, so we can probably close it as well. |
…uniform-range Implement Uniform and UniformRange
No description provided.