Skip to content

Instantly share code, notes, and snippets.

@mschauer
Last active October 2, 2020 17:20
Show Gist options
  • Save mschauer/b8bebe6a5afc14d59322ca6b8adbd209 to your computer and use it in GitHub Desktop.
Save mschauer/b8bebe6a5afc14d59322ca6b8adbd209 to your computer and use it in GitHub Desktop.
Inhomog poisson
function sample_poisson(T, λ, λmax)
t = 0.0
tt = zeros(0)
while t <= T
t = t - log(rand())/λmax
if rand() ≤ λ(t)/λmax
push!(tt, t)
end
end
tt
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment