adding unit test for random selection algorithm