Dear List, I have the following code that does what I want: x <- replicate(5,replicate(10,sum(rnorm(rpois(1,10))))) How might one change it such that the maximum value generated by rnorm(rpois(1,10)) can be retrieved for later use?