- improved get_q_indexes function
- added weighted_choice function