func generate(ch chan float, i int) { go func() { t, t_ave := 0.0, 2.0 for j := 0; j < i; j++ { ch <- t t += t_ave * float(rand.ExpFloat64()) } ch <- t_ave * float(i) * 5.0 }() }
func (q *queue) pass(out chan<- float, middle <-chan float, i int) { t_buf, t_ave := 0.0, 0.5 for j := 0; j < i; j++ { t := <-middle if t > t_buf { t_buf = t } t_buf += t_ave * float(rand.ExpFloat64()) out <- t_buf q.qs.log(t_buf - t) } }