+weight.fac <- 2
+num.calls <- 373
+num.students <- 76
+
+gen.calls.per.students <- function (x) {
+ raw.weights <<- rep(1, num.students)
+ names(raw.weights) <- seq(1, num.students)
+
+ table(sapply(1:num.calls, function (i) {
+ probs <- raw.weights / sum(raw.weights)
+ selected <- sample(names(raw.weights), 1, prob=probs)
+ ## update the raw.weights
+ raw.weights[selected] <<- raw.weights[selected] / weight.fac
+ #print(raw.weights)
+ return(selected)
+ }))
+}
+
+
+simulated.call.list <- unlist(lapply(1:1000, gen.calls.per.students))
+hist(simulated.call.list)
+
+quantile(simulated.call.list, probs=seq(0,1,by=0.01))
+quantile(simulated.call.list, probs=0.05)