Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [code]
- randomsToGenerate<-20
- z<-matrix(0,randomsToGenerate,1)
- for(i in 1:randomsToGenerate){
- lambda<-1
- L<-exp(-lambda)
- k<-0;p<-1
- while(p>L){
- k<-k+1
- p<-p*runif(1)
- z[i]<-k-1
- }
- }
- [/code]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement