There are $P(r+n-1,r-1)$ ways to distribute $n$ objects in $r$ boxes when the order of objects in each box matters. I tried to find out why but I failed.
when the order of objects in each box doesn't matter it equals to $r^n$ because there are $r$ choices for every object and since there are $n$ objects it becomes $r^n$ . But I can't solve this problem when the order of objects in the boxes matter.
$P(n,r) = n!/(n-r)!$