@@ -52,15 +52,8 @@ function rand_single(rng::Random.AbstractRNG, p::PoissonProcess{<:Real}, g, ::Co
5252  V =  measure (g)
5353  n =  rand (rng, Poisson (λ *  V))
5454
55-   if  iszero (n)
56-     nothing 
57-   else 
58-     #  simulate homogeneous process
59-     points =  sample (g, HomogeneousSampling (n))
60- 
61-     #  return point pattern
62-     PointSet (points)
63-   end 
55+   #  simulate n points
56+   iszero (n) ?  nothing  :  PointSet (sample (g, HomogeneousSampling (n)))
6457end 
6558
6659# --------------------
@@ -72,7 +65,8 @@ function rand_single(rng::Random.AbstractRNG, p::PoissonProcess{<:Function}, g,
7265  pp =  rand_single (rng, PoissonProcess (algo. λmax), g, ConstantIntensity ())
7366
7467  #  thin point pattern
75-   thin (pp, RandomThinning (x ->  p. λ (x) /  algo. λmax))
68+   points =  thin (pp, RandomThinning (x ->  p. λ (x) /  algo. λmax))
69+   PointSet (collect (points))
7670end 
7771
7872rand_single (rng:: Random.AbstractRNG , p:: PoissonProcess{<:Function} , d:: Domain , algo:: ConstantIntensity ) = 
@@ -85,17 +79,5 @@ function rand_single(rng::Random.AbstractRNG, p::PoissonProcess{<:AbstractVector
8579  n =  rand (rng, Poisson (sum (λ .*  V)))
8680
8781  #  simulate n points
88-   if  iszero (n)
89-     nothing 
90-   else 
91-     #  sample elements with weights proportial to expected number of points
92-     w =  WeightedSampling (n, λ .*  V, replace= true )
93- 
94-     #  within each element sample a single point
95-     sampler =  HomogeneousSampling (1 )
96-     points =  (first (sample (rng, e, sampler)) for  e in  sample (rng, d, w))
97- 
98-     #  return point pattern
99-     PointSet (points)
100-   end 
82+   iszero (n) ?  nothing  :  PointSet (sample (rng, d, HomogeneousSampling (n, λ .*  V)))
10183end 
0 commit comments