https://github.com/cran/pracma
Raw File
Tip revision: 63e8a52ae6668e736720c89691352d6dc3bc9eb1 authored by HwB on 17 January 2012, 00:00:00 UTC
version 0.9.6
Tip revision: 63e8a52
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