fixed estimate_probs and slightly changed gen_random_output