Skip to content
Prev 309034 / 398513 Next

How generate random numbers from given vector???

Hello,

You don't need the loop, the sample() argument 'size' is there for that. 
See 'sample.

number <- c(0,1,3,4,5,6,8)
rsidp <- function(n) sample(number, n, replace = TRUE)
rsidp(5)

Hope this helps,

Rui Barradas
Em 25-10-2012 20:24, Rlotus escreveu: