# What is the right-way to perform permutation-test using known outcomes?

I have been reading permutation test in Wikipedia. There is no mention about stratified permutation. Is there something like stratified permutation test?

x <- rbind(matrix(rnorm(100, mean = 0, sd = 0.5), ncol = 2),
matrix(rnorm(100, mean = 1, sd = 0.5), ncol = 2),
matrix(rnorm(100, mean = 2, sd = 0.5), ncol = 2))
y <- c(rep(0,50), rep(1,50), rep(2,50))
data <- data.frame(x,y)

perms <- factorial(nrow(data))
# 5.713384e+262


Is it advisable to do permutations perms times(5.713384e+262) or only nrow**different possible labels(150**3=3375000), if all possible permutations need to be considered?

The observed data is shuffled by assigning different outcome values to each observation from the set of observed outcomes right? If yes, I have a few questions:

1. Should the assignment be always with the same frequency? As in the above example, the permuted y values should always be having same frequency of 50?