From 814d40fc8e8b66b6c89cf5437a88a90eb1598ece Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Wed, 17 Jan 2018 22:47:55 +0100 Subject: [PATCH] Compat.Random --- README.md | 4 ++++ src/Compat.jl | 6 ++++++ test/runtests.jl | 4 ++++ 3 files changed, 14 insertions(+) diff --git a/README.md b/README.md index 372b39a56..348d5cc7e 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/src/Compat.jl b/src/Compat.jl index e4603a218..b83d3b641 100644 --- a/src/Compat.jl +++ b/src/Compat.jl @@ -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 diff --git a/test/runtests.jl b/test/runtests.jl index dbc8773a2..fcffacefc 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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")