Skip to content

Commit 37a1150

Browse files
authored
Compat.Random (#460)
1 parent 2ccee51 commit 37a1150

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ Currently, the `@compat` macro supports the following syntaxes:
110110
* `using Compat.SparseArrays` is provided on versions older than 0.7, where this library is
111111
not yet part of the standard library ([#25249]).
112112

113+
* `using Compat.Random` is provided on versions older than 0.7, where this library is
114+
not yet part of the standard library ([#24874]).
115+
113116
## New functions, macros, and methods
114117

115118
* `@views` takes an expression and converts all slices to views ([#20164]), while
@@ -438,6 +441,7 @@ includes this fix. Find the minimum version from there.
438441
[#24714]: https://github.com/JuliaLang/julia/issues/24714
439442
[#24785]: https://github.com/JuliaLang/julia/issues/24785
440443
[#24808]: https://github.com/JuliaLang/julia/issues/24808
444+
[#24874]: https://github.com/JuliaLang/julia/issues/24874
441445
[#25012]: https://github.com/JuliaLang/julia/issues/25012
442446
[#25021]: https://github.com/JuliaLang/julia/issues/25021
443447
[#25056]: https://github.com/JuliaLang/julia/issues/25056

src/Compat.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,12 @@ else
802802
import SparseArrays
803803
end
804804

805+
if VERSION < v"0.7.0-DEV.3406"
806+
const Random = Base.Random
807+
else
808+
import Random
809+
end
810+
805811
if VERSION < v"0.7.0-DEV.2609"
806812
@eval module SuiteSparse
807813
if Base.USE_GPL_LIBS

test/runtests.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,6 +1084,10 @@ let A = [0, 0, 0], B = [1, 2, 3]
10841084
@test unsafe_copyto!(A, 2, B, 1, 1) === A == [0, 1, 0]
10851085
end
10861086

1087+
# 0.7.0-DEV.3406
1088+
using Compat.Random
1089+
@test rand(MersenneTwister(1234)) == 0.5908446386657102
1090+
10871091
# 0.7
10881092
@test contains("Hello, World!", r"World")
10891093

0 commit comments

Comments
 (0)