powered by
multinomial(weights, k)
weights <- c(0.3, 0.5, 0.2) multinomial(weights, 3) #[1] 0 1 0
Run the code above in your browser using DataLab