Changed heuristic function. Now coefficients are chosen pseudo-randomly