Let me just rename the variable and remove few things to focus on the core aspects of the problem
For LoopIterationNumber = 0 To 7 Dim PickedIndex = GenerateARandomNumberForMe.Next(0, ItemsToPickFrom.Count) ' This'll be a whole number (Integer) ' PickedIndex contains a random index position. It's just a number. ' ItemsToPickFrom.Count going to change each iteration of the loop ' because of the following line ItemsToPickFrom.RemoveAt( PickedIndex ) ' where we remove the item at the index position. ' ' Q:- Where is the item we removed? Or the Item (or Value) we wanted to be picked? ' PickedItem.Add( PickedIndex ) ' You add the PickedIndex not the PickedItem ' Think the range of items to choose from is get smaller, thus the index range is getting smaller. ' So this doesn't match the full index of the original 16, but the random index of an item ' in a collection that is getting smaller each iteration Console.WriteLine( PickedItems.Item( LoopIterationNumber ) ) ' This is going output on the first 8 items from PickedItems, everytime this block of code is called. Next
What do we (you) need to do the code above to add the PickedItem to the List of PickedItems?
Hint: Value <> Index "E" <> 4