Skip to content

Instantly share code, notes, and snippets.

@fonnesbeck
Created March 25, 2010 00:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fonnesbeck/342994 to your computer and use it in GitHub Desktop.
Save fonnesbeck/342994 to your computer and use it in GitHub Desktop.
Truncated Poisson random numbers in R
rtpois <- function(N, lambda, k) qpois(runif(N, ppois(k, lambda), 1), lambda)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment