Last active
October 2, 2020 17:20
-
-
Save mschauer/b8bebe6a5afc14d59322ca6b8adbd209 to your computer and use it in GitHub Desktop.
Inhomog poisson
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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