@@ -236,6 +236,7 @@ Base.@kwdef struct SymmetricAlphaStable{T} <: Distributions.ContinuousUnivariate
236236end
237237Distributions. params (d:: SymmetricAlphaStable ) = (d. α, d. scale, d. location)
238238Distributions. cf (d:: SymmetricAlphaStable , t:: Real ) = cf (AlphaStable (d), t)
239+ Random. rand (rng:: AbstractRNG , d:: SymmetricAlphaStable ) = rand (rng, AlphaStable (d))
239240
240241function AlphaStable (d:: SymmetricAlphaStable )
241242 AlphaStable (α= d. α,scale= d. scale,location= d. location)
@@ -412,9 +413,9 @@ function Random.rand!(rng::AbstractRNG, d::AlphaSubGaussian{T}, x::AbstractArray
412413 nmax, nmin, res, rind, vjoint = matdict[" Nmax" ]:: Float64 , matdict[" Nmin" ]:: Float64 , matdict[" res" ]:: Float64 , vec (matdict[" rind" ]):: Vector{Float64} , matdict[" vJoint" ]:: Matrix{Float64}
413414 step = (log10 (nmax)- log10 (nmin))/ res
414415 m> size (vjoint, 1 )- 1 && throw (DomainError (R, " The dimensions of `R` exceed the maximum possible 10x10" ))
415- A = rand (AlphaStable (T (α/ 2 ), one (T), T (2 * cos (π* α/ 4 )^ (2.0 / α)), zero (T)))
416- CT = rand (Chisq (m))
417- S = randn (m)
416+ A = rand (rng, AlphaStable (T (α/ 2 ), one (T), T (2 * cos (π* α/ 4 )^ (2.0 / α)), zero (T)))
417+ CT = rand (rng, Chisq (m))
418+ S = randn (rng, m)
418419 S = S/ sqrt (sum (abs2,S))
419420 xtmp = ((sigrootx1* sqrt (A* CT))* S)'
420421 if n<= m
@@ -430,8 +431,8 @@ function Random.rand!(rng::AbstractRNG, d::AlphaSubGaussian{T}, x::AbstractArray
430431 norm1 = subgausscondprobtabulate (α, x1, mode, invRx1, invR, vjoint, nmin, nmax, step, rind, kappa, k1, k2, kmarg)
431432 notaccept = true
432433 while notaccept
433- u = rand ()
434- v = (norms/ norm1)* rand (TDist (vstud)) + mode
434+ u = rand (rng )
435+ v = (norms/ norm1)* rand (rng, TDist (vstud)) + mode
435436 gv = (norm1/ norms)* pdf (TDist (vstud), (v- mode)* (norm1/ norms))
436437 fv = subgausscondprobtabulate (α, x1, v, invRx1, invR, vjoint, nmin, nmax, step, rind, kappa, k1, k2, kmarg)
437438 if c* u <= fv/ gv
0 commit comments