Skip to content

Commit

Permalink
Merge pull request #19 from oyamad/fbot/deps
Browse files Browse the repository at this point in the history
Fix deprecations
  • Loading branch information
oyamad committed Aug 9, 2018
2 parents 5a07639 + 3b0b4e9 commit b5c119e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
19 changes: 3 additions & 16 deletions src/matching_tools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -191,22 +191,9 @@ function _random_caps(rng::AbstractRNG, m::Int, n::Int)
end


if VERSION < v"0.7-"
# Copied from base/random.jl
"Return a random `Int` (masked with `mask`) in ``[0, n)``, when `n <= 2^52`."
@inline function rand_lt(r::AbstractRNG, n::Int, mask::Int=nextpow2(n)-1)
# this duplicates the functionality of RangeGenerator objects,
# to optimize this special case
while true
x = (Base.Random.rand_ui52_raw(r) % Int) & mask
x < n && return x
end
end
else
# From stdlib/Random/src/misc.jl
rand_lt(r::AbstractRNG, n::Int, mask::Int=nextpow2(n)-1) =
rand(r, Random.ltm52(n, mask))
end
# From stdlib/Random/src/misc.jl
rand_lt(r::AbstractRNG, n::Int, mask::Int=nextpow(2, n)-1) =
rand(r, Random.ltm52(n, mask))


# In-place version of randperm in base/random.jl
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using MatchingMarkets
using Base.Test
using Test

include("test_deferred_acceptance.jl")
include("test_matching_tools.jl")
Expand Down

0 comments on commit b5c119e

Please sign in to comment.