@@ -12,8 +12,8 @@ Random.rand(rng::PassthroughRNG) = rand()
1212Random. randexp (rng:: PassthroughRNG ) = randexp ()
1313Random. randn (rng:: PassthroughRNG ) = randn ()
1414
15- count_rand (λ) = count_rand (Random. GLOBAL_RNG, λ)
16- function count_rand (rng:: AbstractRNG , λ)
15+ count_rand (λ:: Real ) = count_rand (Random. GLOBAL_RNG, λ)
16+ function count_rand (rng:: AbstractRNG , λ:: Real )
1717 n = 0
1818 c = randexp (rng)
1919 while c < λ
3131#
3232# For μ sufficiently large, (i.e. >= 10.0)
3333#
34- ad_rand (λ) = ad_rand (Random. GLOBAL_RNG, λ)
35- function ad_rand (rng:: AbstractRNG , λ)
34+ ad_rand (λ:: Real ) = ad_rand (Random. GLOBAL_RNG, λ)
35+ function ad_rand (rng:: AbstractRNG , λ:: Real )
3636 s = sqrt (λ)
3737 d = 6 * λ^ 2
3838 L = floor (Int, λ - 1.1484 )
@@ -82,7 +82,7 @@ function ad_rand(rng::AbstractRNG, λ)
8282end
8383
8484# Procedure F
85- function procf (λ, K:: Int , s:: Float64 )
85+ function procf (λ:: Real , K:: Int , s:: Float64 )
8686 # can be pre-computed, but does not seem to affect performance
8787 INV_SQRT_2PI = inv (sqrt (2pi ))
8888 ω = INV_SQRT_2PI / s
@@ -133,7 +133,7 @@ pois_rand(rng, λ)
133133pois_rand(PoissonRandom.PassthroughRNG(), λ)
134134```
135135"""
136- pois_rand (λ) = pois_rand (Random. GLOBAL_RNG, λ)
137- pois_rand (rng:: AbstractRNG , λ) = λ < 6 ? count_rand (rng, λ) : ad_rand (rng, λ)
136+ pois_rand (λ:: Real ) = pois_rand (Random. GLOBAL_RNG, λ)
137+ pois_rand (rng:: AbstractRNG , λ:: Real ) = λ < 6 ? count_rand (rng, λ) : ad_rand (rng, λ)
138138
139139end # module
0 commit comments