I want to randomly choose an item from a list of items, each of which has a different probability of being chosen. So essentially I have
etc.
I want to reach in and choose an item randomly and to have the frequency with which I choose item A, B, C, etc. reflect the frequency that it is present. I can think of messy ways to do this, e.g. populate an array with items according to their frequencies and then randomly choose one item from the array. Can someone suggest a better approach?
Thank you.