updated random_selection algorithm