INNER CODE UNIT · Go

expected

asobti/kube-monkey · internal/pkg/calendar/calendar.go:119

	expected := (float64(24*time.Hour) / float64(mtbf)) * (float64(remaining) / float64(full))

	// The whole part is a kill we owe for sure, the fraction left over is the
	// chance of one more.
	count := int(expected)
	if r.Float64() < expected-float64(count) {
		count++
	}

	killtimes := make([]time.Time, 0, count)
	for i := 0; i < count; i++ {
		killtimes = append(killtimes, start.Add(time.Duration(r.Int63n(int64(remaining)))))
	}
	sort.Slice(killtimes, func(i, j int) bool { return killtimes[i].Before(killtimes[j]) })

	return killtimes
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…