stack overflow error, i want to call a method within itself not using recursion tho

so i have this problem, i have a 5 by 5 board and i need to randomize the colors of the circles until they are just right. this method i have randomizes the colors and checks to see if they are in the right order, if they are not i call the method again.

but this might happen 100's or thousands of times, so i get stack overflow. can i call this method again without recursion and make it run faster at the same time?