Skip to content

Commit

Permalink
rand with SVector
Browse files Browse the repository at this point in the history
  • Loading branch information
henry2004y committed Oct 29, 2024
1 parent 8417196 commit 00e4d0f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/sampler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Sample a 3D velocity from a [`Maxwellian`](@ref) distribution `vdf` using the Bo
Sample a 3D velocity from a [`BiMaxwellian`](@ref) distribution `vdf` using the Box-Muller method.
"""
function sample(vdf::Maxwellian{T}) where T
r1, r2, θ, ϕ = rand(T, 4)
r1, r2, θ, ϕ = rand(SVector{4, T})
m1 = (-2*log(r1))
m2 = (-2*log(r2))

Expand All @@ -83,7 +83,7 @@ function sample(vdf::Maxwellian{T}) where T
end

function sample(vdf::BiMaxwellian{T, U}) where {T, U}
r1, r2, θ, ϕ = rand(T, 4)
r1, r2, θ, ϕ = rand(SVector{4, T})
m1 = (-2*log(r1))
m2 = (-2*log(r2))

Expand Down

0 comments on commit 00e4d0f

Please sign in to comment.