# Create a matrix X with the numbers 1 to 10 are twice and 11 to 50 are once.
# The matrix has 6 rows and 10 columns
set.seed(123)
X <- matrix(sample(c(rep(1:10, 2), 11:50), replace = FALSE), ncol = 10)
X
# Swap pairs
B <- swap_pairs(X, starting_dist = 3)
B$optim_design
B$designs
B$distances
Run the code above in your browser using DataLab