/ =

0

Test

Mixing Level Method

This is the method I've used to get an approximate value for how mixed the balls are.

The box is divided into a 2x2 grid.

In each grid space the two types of balls are counted, and the total of one type is subtracted from the total of the other type to get the difference.

21
12
-
9
=
3

All the difference results from each grid space are then added together, and the total is divided by the total number of balls in the box.

If the two types of balls are equally distributed in the grid spaces, they will all cancel each other out, and the sum of differences will be 0.

0 / total = 0

If the two types of balls are all separate and don't share grid spaces, nothing will be subtracted, and the sum of differences will be the same as the ball total.

total / total = 1

This will give a result between 0 for evenly mixed, and 1 for unmixed.

This number is then flipped so that 0 is unmixed, and 1 is evenly mixed.