Sampling from a normal distribution

julia> using Distributions, Random

julia> d = Normal(0.16, 0.05)
Normal{Float64}(μ=0.16, σ=0.05)

julia> td = truncated(d, 0.0, Inf)
Truncated(Normal{Float64}(μ=0.16, σ=0.05), range=(0.0, Inf))

julia> rand(td, 20)'
1×20 LinearAlgebra.Adjoint{Float64,Array{Float64,1}}:
 0.111023  0.17302  0.136576  0.115955  0.173886  0.236196  0.0711136  0.013347  0.199113  0.275679  0.116447  0.177286  0.152207  0.276651  0.110082  0.163348  0.0727901  0.115974  0.147312  0.200701
3 Likes