Its using collisions, so the first two that hit the collider within range will pair up. I think it tends to be a bit random with how Unity handles the collisions, so the main task is the make the range only hit who you want.
thanks for playing, I'm glad you enjoyed it!