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

deprecate rand(::Tuple) #25429

Merged
merged 1 commit into from
Jan 15, 2018
Merged

deprecate rand(::Tuple) #25429

merged 1 commit into from
Jan 15, 2018

Conversation

rfourquet
Copy link
Member

Pre-requisite for #25278.

@rfourquet rfourquet added domain:randomness Random number generation and the Random stdlib kind:deprecation This change introduces or involves a deprecation labels Jan 6, 2018
@rfourquet rfourquet added this to the 1.0 milestone Jan 6, 2018
@rfourquet rfourquet force-pushed the rf/rand/depr-tuple branch 2 times, most recently from 1d8e045 to 8561baf Compare January 6, 2018 14:21
Copy link
Member

@Sacha0 Sacha0 left a comment

Choose a reason for hiding this comment

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

lgtm! Thanks @rfourquet! :)

@@ -1138,6 +1138,10 @@ import .Random: srand
@deprecate srand(filename::AbstractString, n::Integer=4) srand(read!(filename, Vector{UInt32}(uninitialized, Int(n))))
@deprecate MersenneTwister(filename::AbstractString) srand(MersenneTwister(0), read!(filename, Vector{UInt32}(uninitialized, Int(4))))

# PR #25429
@deprecate rand(r::AbstractRNG, dims::Dims) rand(r, Float64, dims)
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Does this one really need to be deprecated? I thought a dims tuple as the second argument was ok (and there are still some other methods with that).

Copy link
Member Author

Choose a reason for hiding this comment

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

in rand([rng], [S], [dims]), the conflict is when using t::Tuple either for S or for dims, whether rng is specified or not. In rand(rng, (1, 2, 3)), the conflict is the same as in rand((1, 2, 3)). A tuple as the second argument is ok when rng is not specifed, as in rand(Float64, (1, 2, 3)).

and there are still some other methods with that

I must have missed that, but no test catched this apparently...

Copy link
Sponsor Member

Choose a reason for hiding this comment

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

I see. In that case this seems fine as-is.

@rfourquet
Copy link
Member Author

rfourquet commented Jan 15, 2018

The Appveyor failure seems to be a timeout (the job lasted 2 hours), and the travis failure is a problem with apt-get, which must be unrelated. Should be good to merge.

@JeffBezanson JeffBezanson merged commit e88cbd9 into master Jan 15, 2018
@JeffBezanson JeffBezanson deleted the rf/rand/depr-tuple branch January 15, 2018 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:randomness Random number generation and the Random stdlib kind:deprecation This change introduces or involves a deprecation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants