-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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 #8257 #8273
Fix #8257 #8273
Conversation
Is this within the scope of @JuliaBackports? |
Yes I think we could backport this. Could you add a test as well? |
Random and floating point inaccuracies is really hard to test. I made a simple attempt. I also changed |
Sorry, the first commit was without the test. |
@@ -219,17 +219,9 @@ end | |||
rand!{T<:Union(Signed,Unsigned,Bool,Char)}(r::UnitRange{T}, A::AbstractArray) = rand!(RandIntGen(r), A) | |||
|
|||
function rand!{T}(r::Range{T}, A::AbstractArray) |
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.
With this change you can get rid of parametrisation by T
, no?
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.
Yes
This version of `rand(r::Range)` and `rand!(r::Range,a::AbstractArray)` uses getindex instead of trying to calculate the exact value of the range. This is good because we avoid duplicating the getindex logic in `FloatRange` Also added tests, and fixed a small issue in `in(v, r::Range)` where two calls to step() is not needed
I decided to merge this so that @rfourquet can easier base his work on this change. If nobody has objections in a few days, I will also backport to |
+1 for backporting |
This version of `rand(r::Range)` and `rand!(r::Range,a::AbstractArray)` uses getindex instead of trying to calculate the exact value of the range. This is good because we avoid duplicating the getindex logic in `FloatRange` Also added tests, and fixed a small issue in `in(v, r::Range)` where two calls to step() is not needed Backport of 48f27bc PR: #8273
Backported in 7edddb0 |
This new version of
rand(r::Range)
andrand!(r::Range,a::AbstractArray)
uses getindex instead of trying to calculate the exact value of the
range. This is good because we avoid duplicating the getindex logic in
FloatRange