File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed
Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -2,8 +2,9 @@ __precompile__()
22
33module PoissonRandom
44
5+ using Random
56
6- function count_rand (λ,rng:: AbstractRNG = Base . GLOBAL_RNG)
7+ function count_rand (λ,rng:: AbstractRNG = Random . GLOBAL_RNG)
78 n = 0
89 c = randexp (rng)
910 while c < λ
2122#
2223# For μ sufficiently large, (i.e. >= 10.0)
2324#
24- function ad_rand (λ,rng:: AbstractRNG = Base . GLOBAL_RNG)
25+ function ad_rand (λ,rng:: AbstractRNG = Random . GLOBAL_RNG)
2526 s = sqrt (λ)
2627 d = 6.0 * λ^ 2
2728 L = floor (Int,λ- 1.1484 )
Original file line number Diff line number Diff line change 11using PoissonRandom
22import Distributions
3- using Test
3+ using Test, Statistics
44
55n_tsamples = 10 ^ 5
66
@@ -33,14 +33,14 @@ function test_samples(rand_func,
3333 rmin = floor (Int,quantile (distr, 0.00001 )):: Int
3434 rmax = floor (Int,quantile (distr, 0.99999 )):: Int
3535 m = rmax - rmin + 1 # length of the range
36- p0 = Distributions. pdf .(distr, rmin: rmax) # reference probability masses
36+ p0 = Distributions. pdf .(( distr,) , rmin: rmax) # reference probability masses
3737 @assert length (p0) == m
3838
3939 # determine confidence intervals for counts:
4040 # with probability q, the count will be out of this interval.
4141 #
42- clb = Vector {Int} (m)
43- cub = Vector {Int} (m)
42+ clb = Vector {Int} (undef, m)
43+ cub = Vector {Int} (undef, m)
4444 for i = 1 : m
4545 bp = Distributions. Binomial (n, p0[i])
4646 clb[i] = floor (Int,quantile (bp, q/ 2 ))
You can’t perform that action at this time.
0 commit comments