Probabilistic heuristic algorithm for finding global min\max of various function