R/shuffle.R

shuffle.Rd

A version of sample() which does not treat positive scalar integer x differently. See example.

sample()

x

shuffle(x, n = length(x), ...)

:: vector() Vector to sample elements from.

vector()

:: integer() Number of elements to sample.

integer()

:: any Arguments passed down to base::sample.int().

any

base::sample.int()

x = 2:3 sample(x)#> [1] 3 2shuffle(x)#> [1] 2 3 x = 3 sample(x)#> [1] 2 3 1shuffle(x)#> [1] 3