most recent changes to make the heuristic function take a random integer