random selection algorithm.