powered by
Given a number of boxes, randomly distribute n balls into these boxes.
rtoboxes(n, boxes, weights = NULL, capacities = NULL)
A vector of natural numbers with the same length as boxes. The number of balls placed in each box.
boxes
A natural number. The number of balls to put into the boxes.
A natural number. The number of boxes.
A non-negative numeric vector. The relative probabilities of putting a ball in each box. Default is each box is equally likely.
A vector of natural numbers. The capacity of each box. Default is each box has infinite capacity.
rfromboxes
rtoboxes(30, 7) rtoboxes(30, 7, capacities = c(rep(1, 3), rep(7, 4))) rtoboxes(30, 7, capacities = c(rep(1, 3), rep(70, 4)), weights = c(rep(0.1, 6), 1) )
Run the code above in your browser using DataLab