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

Fix type bug in Uniform #1860

Closed
wants to merge 1 commit into from
Closed

Conversation

Red-Portal
Copy link
Contributor

@Red-Portal Red-Portal commented May 25, 2024

Fixed the bug where rand(Uniform{T}) returned a Float64 instead of T.

Fixed the bug where `rand(Uniform{T})` did not preserve the type of `Uniform{T}`.
Copy link
Member

@andreasnoack andreasnoack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please search the issue tracker for discussions about the relationship between the type parameter of the distribution and the type of the random variates. It's a bit complicated. Your version will also fail in several cases. E.g. when the parameters are Rational{Int} or Int (the latter requiring that you bypass the usual constructor with

julia> Uniform{Int}(0, 1)
Uniform{Int64}(a=0, b=1)

@Red-Portal
Copy link
Contributor Author

Hmmm... okay, then is the current behavior intended by the current policy?

@andreasnoack
Copy link
Member

Yes. I'd say so.

@Red-Portal
Copy link
Contributor Author

Okay got it

@Red-Portal Red-Portal closed this May 27, 2024
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

Successfully merging this pull request may close these issues.

2 participants