fixed minor bug in the randomized selection algorithm