Skip to content

Commit

Permalink
Compat.Random (#460)
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre authored Jan 18, 2018
1 parent 2ccee51 commit 37a1150
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ Currently, the `@compat` macro supports the following syntaxes:
* `using Compat.SparseArrays` is provided on versions older than 0.7, where this library is
not yet part of the standard library ([#25249]).

* `using Compat.Random` is provided on versions older than 0.7, where this library is
not yet part of the standard library ([#24874]).

## New functions, macros, and methods

* `@views` takes an expression and converts all slices to views ([#20164]), while
Expand Down Expand Up @@ -438,6 +441,7 @@ includes this fix. Find the minimum version from there.
[#24714]: https://github.com/JuliaLang/julia/issues/24714
[#24785]: https://github.com/JuliaLang/julia/issues/24785
[#24808]: https://github.com/JuliaLang/julia/issues/24808
[#24874]: https://github.com/JuliaLang/julia/issues/24874
[#25012]: https://github.com/JuliaLang/julia/issues/25012
[#25021]: https://github.com/JuliaLang/julia/issues/25021
[#25056]: https://github.com/JuliaLang/julia/issues/25056
Expand Down
6 changes: 6 additions & 0 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,12 @@ else
import SparseArrays
end

if VERSION < v"0.7.0-DEV.3406"
const Random = Base.Random
else
import Random
end

if VERSION < v"0.7.0-DEV.2609"
@eval module SuiteSparse
if Base.USE_GPL_LIBS
Expand Down
4 changes: 4 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,10 @@ let A = [0, 0, 0], B = [1, 2, 3]
@test unsafe_copyto!(A, 2, B, 1, 1) === A == [0, 1, 0]
end

# 0.7.0-DEV.3406
using Compat.Random
@test rand(MersenneTwister(1234)) == 0.5908446386657102

# 0.7
@test contains("Hello, World!", r"World")

Expand Down

0 comments on commit 37a1150

Please sign in to comment.