Added logic to the balanced mutation method for randomization.