Commits

Jason Scheirer  committed 388b989

Work-in-progress on problem 121

  • Participants
  • Parent commits fa5ed25

Comments (0)

Files changed (1)

File problem121.go

+package main
+
+import (
+	"fmt"
+)
+
+func ProbabilityAtN(iteration uint64) float64 {
+	return 1. / (float64(iteration) + 2.)
+}
+
+func ProbabilityArrayForIterationCount(rounds uint64) []float64 {
+	probability_array := make([]float64, rounds)
+	for index := uint64(0); index < rounds; index++ {
+		probability_array[index] = ProbabilityAtN(index)
+	}
+
+	return probability_array
+}
+
+func main() {
+	fmt.Printf("%v\n", ProbabilityArrayForIterationCount(15))
+}