https://github.com/cran/pracma
Raw File
Tip revision: 392ae21a013fb3f518e8f9eb8efb458a55a2eca2 authored by HwB on 09 April 2011, 00:00:00 UTC
version 0.3-0
Tip revision: 392ae21
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