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