https://github.com/cran/pracma
Raw File
Tip revision: 84a50252b184200bc6328ef733b7f94da0b64e4b authored by Hans W. Borchers on 29 May 2016, 21:34:12 UTC
version 1.9.3
Tip revision: 84a5025
perms.R
##
##  p e r m s . R  Test Suite
##

perms <- pracma::perms
randperm <- pracma::randperm

identical(perms(2), matrix(2, 1, 1))
identical(perms(c(1, 2)), matrix(c(2, 1, 1, 2), 2, 2))
identical(nrow(perms(1:6)), 720L)

all(c(1,2,3) %in% randperm(c(1,2,3)))
back to top