I need to generate random numbers with equal number of variables, For example
Variables[A,B,C] (A = 1, B = 2, C = 3)
sample function is used to generate random numbers.
You can specify exactly what values you want to feature in your random ordering by leaving the
replace argument as
First create all the values you want to feature, repeated as many times as you want them.
vals <- rep(c("A", "B", "C"), each = 4L)
Then sample your selection without replacing:
rsample <- sample(vals, 12L, replace = FALSE)