File tree 2 files changed +7
-6
lines changed
2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -2,8 +2,9 @@ __precompile__()
2
2
3
3
module PoissonRandom
4
4
5
+ using Random
5
6
6
- function count_rand (λ,rng:: AbstractRNG = Base . GLOBAL_RNG)
7
+ function count_rand (λ,rng:: AbstractRNG = Random . GLOBAL_RNG)
7
8
n = 0
8
9
c = randexp (rng)
9
10
while c < λ
21
22
#
22
23
# For μ sufficiently large, (i.e. >= 10.0)
23
24
#
24
- function ad_rand (λ,rng:: AbstractRNG = Base . GLOBAL_RNG)
25
+ function ad_rand (λ,rng:: AbstractRNG = Random . GLOBAL_RNG)
25
26
s = sqrt (λ)
26
27
d = 6.0 * λ^ 2
27
28
L = floor (Int,λ- 1.1484 )
Original file line number Diff line number Diff line change 1
1
using PoissonRandom
2
2
import Distributions
3
- using Test
3
+ using Test, Statistics
4
4
5
5
n_tsamples = 10 ^ 5
6
6
@@ -33,14 +33,14 @@ function test_samples(rand_func,
33
33
rmin = floor (Int,quantile (distr, 0.00001 )):: Int
34
34
rmax = floor (Int,quantile (distr, 0.99999 )):: Int
35
35
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
37
37
@assert length (p0) == m
38
38
39
39
# determine confidence intervals for counts:
40
40
# with probability q, the count will be out of this interval.
41
41
#
42
- clb = Vector {Int} (m)
43
- cub = Vector {Int} (m)
42
+ clb = Vector {Int} (undef, m)
43
+ cub = Vector {Int} (undef, m)
44
44
for i = 1 : m
45
45
bp = Distributions. Binomial (n, p0[i])
46
46
clb[i] = floor (Int,quantile (bp, q/ 2 ))
You can’t perform that action at this time.
0 commit comments