I have a function that uses runif to calculate some value, so each time it is called, the result varies slightly. I want to calculate the mean of the result of
runif
replicate is your friend. See ?replicate
replicate
?replicate
replicate(10, my_function_call()) # this would be what you're looking for