SampleOne()
is a fast alternative to sample()
that avoids some checks.
SampleOne(x, len = length(x))
A vector to sample.
(Optional) Integer specifying length of x
.
SampleOne()
returns a length one vector, randomly sampled from x
.
SampleOne(9:10)
#> [1] 9
SampleOne(letters[1:4])
#> [1] "d"