Extracted the pure core from randomLeastDegreeSquare.