My code in R to the generation of random numbers:
A<-c(8, 13, 13, 14, 15, 11, 16, 11)
n<-15
B<-c()
for (j in 1:length(A)) {
arrival<-vector("numeric", length = 15)
sum<-A[j]
for (i in 1:sum) {
home<-abs(floor((runif(1,1,(n+0.99999)))))
arrival[home]<-arrival[home]+1
}...