Added get_prob_rand function