rbinom(m,n=size,p=prob) #For instance 10 numbers in [0,1,2] with p=0.5 rbinom(10,2,0.5) #2 2 1 0 0 2 0 0 1 2