public void Test1() { int[] nums = new int[] { 1, 2, 3, 3, 3 }; Solution solution = new Solution(nums); // pick(3) should return either index 2, 3, or 4 randomly. Each index should have equal probability of returning. var four = solution.Pick(3); // pick(1) should return 0. Since in the array only nums[0] is equal to 1. var one = solution.Pick(1); Assert.AreEqual(one, 0); }