sample.r 187 B

1234
  1. print(sample(1:3))
  2. print(sample(1:3, size=3, replace=FALSE)) # same as previous line
  3. print(sample(c(2,5,3), size=4, replace=TRUE))
  4. print(sample(1:2, size=10, prob=c(1,3), replace=TRUE))