Faster than inbuilt sample because it avoids some checks.
sample
SampleOne(x, len = length(x))
A vector to sample.
(optionally) integer specifying length of x.
x
A vector of length one, randomly sampled from x.
# NOT RUN { SampleOne(9:10) SampleOne(letters[1:4]) # }
Run the code above in your browser using DataLab