Thanks David first. Probably, David misunderstood my points. source vector = (1,2) the length of the target vector = 3 My expected "complete" outputs should be: 111, 112, 121, 122, 211, 212, 221, 222. sample(c(1,2),3,replace=TRUE) just gives me one "randomly sampled" combination at a time. However, I need the whole list displayed above at a time. Rui