func frequencyTest(gen *Generator, d, iters int) (float64, float64) { bins := make([]int, d) for n := 0; n < iters; n++ { bins[gen.UniformInt(0, d-1)]++ } probs := make([]float64, d) for i, _ := range probs { probs[i] = 1 / float64(d) } chiSqr, prob := stats.ChiSqr(bins, probs) return chiSqr, prob }
func serialTest(gen *Generator, d, iters int) (float64, float64) { bins := make([]int, d*d) for n := 0; n < iters; n++ { x, y := gen.UniformInt(0, d-1), gen.UniformInt(0, d-1) bins[y*d+x]++ } probs := make([]float64, d*d) for i, _ := range probs { probs[i] = 1 / float64(d*d) } chi, prob := stats.ChiSqr(bins, probs) return chi, prob }