https://github.com/cran/pracma
Raw File
Tip revision: 0e3ae6b4108dcce6052c1e366d66aa83f8502596 authored by HwB on 10 January 2013, 00:00:00 UTC
version 1.3.8
Tip revision: 0e3ae6b
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