| rtoboxes {detrendr} | R Documentation | 
Randomly place balls in boxes.
Description
Given a number of boxes, randomly distribute n balls into these boxes.
Usage
rtoboxes(n, boxes, weights = NULL, capacities = NULL)
Arguments
n | 
 A natural number. The number of balls to put into the boxes.  | 
boxes | 
 A natural number. The number of boxes.  | 
weights | 
 A non-negative numeric vector. The relative probabilities of putting a ball in each box. Default is each box is equally likely.  | 
capacities | 
 A vector of natural numbers. The capacity of each box. Default is each box has infinite capacity.  | 
Value
A vector of natural numbers with the same length as boxes. The
number of balls placed in each box.
See Also
rfromboxes
Examples
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)
)
[Package detrendr version 0.6.15 Index]