sample(x, size=<<see below>>, replace=F, prob=<<see below>>)
If x has length 1 and thus is treated as the population size, it cannot be larger than the largest positive integer on the machine (.Machine$integer.max, 2147483647 on a 32 bit computer).
sample(state.name, 10) # pick 10 unique states at random sample(1e6, 75) # pick 75 numbers between 1 and one million sample(50) # random permutation of numbers 1:50 sample(0:1,100,c(.3,.7),T) # Bernoulli(.3) sample of size 100# 20 uniformly distributed numbers on the integers 1:10 with replacement sample(10, 20, T)
sample(5, 24, prob=c(.3,.4,.1,.1,.1), replace=T)