https://github.com/cran/pracma
Raw File
Tip revision: 113add4c7a9bfd37466a9b41cf2dc060b7b87091 authored by HwB on 06 December 2012, 00:00:00 UTC
version 1.3.1
Tip revision: 113add4
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