This question already has an answer here:
I'm wondering if anyone can guide me with following problem... Each fruit has different chance to be called out.
Apple - 80% Orange - 10% Banana - 10%
Each time a user click on the random image, only 1 fruit will come out with above weight. I have no idea how I can calcuate to get that result. Pseudo code example is fine for me.