Quick optimized equivalent to sample(x,size,replace=TRUE)

quick_sample(x, size)

Arguments

x

a vector

size

number of elements to sample

Value

sample of size "size" taken from x

Examples

quick_sample(1:20,5)
#> [1] 13 20 7 10 20