Skip to content

Commit

Permalink
fix depwarns
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Jul 22, 2018
1 parent 93dc1ac commit ef7b9fd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/PoissonRandom.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ __precompile__()

module PoissonRandom

using Random

function count_rand(λ,rng::AbstractRNG=Base.GLOBAL_RNG)
function count_rand(λ,rng::AbstractRNG=Random.GLOBAL_RNG)
n = 0
c = randexp(rng)
while c < λ
Expand All @@ -21,7 +22,7 @@ end
#
# For μ sufficiently large, (i.e. >= 10.0)
#
function ad_rand(λ,rng::AbstractRNG=Base.GLOBAL_RNG)
function ad_rand(λ,rng::AbstractRNG=Random.GLOBAL_RNG)
s = sqrt(λ)
d = 6.0*λ^2
L = floor(Int,λ-1.1484)
Expand Down
8 changes: 4 additions & 4 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using PoissonRandom
import Distributions
using Test
using Test, Statistics

n_tsamples = 10^5

Expand Down Expand Up @@ -33,14 +33,14 @@ function test_samples(rand_func,
rmin = floor(Int,quantile(distr, 0.00001))::Int
rmax = floor(Int,quantile(distr, 0.99999))::Int
m = rmax - rmin + 1 # length of the range
p0 = Distributions.pdf.(distr, rmin:rmax) # reference probability masses
p0 = Distributions.pdf.((distr,), rmin:rmax) # reference probability masses
@assert length(p0) == m

# determine confidence intervals for counts:
# with probability q, the count will be out of this interval.
#
clb = Vector{Int}(m)
cub = Vector{Int}(m)
clb = Vector{Int}(undef,m)
cub = Vector{Int}(undef,m)
for i = 1:m
bp = Distributions.Binomial(n, p0[i])
clb[i] = floor(Int,quantile(bp, q/2))
Expand Down

0 comments on commit ef7b9fd

Please sign in to comment.