Quantcast
Viewing all articles
Browse latest Browse all 27078

VS 2010 Randomly selected item from list which have a %

Basically, I know how to get a random number but I'm not sure how to select an item from a list which has a percentage of being randomly selected.

EG. If this is my list

Red - 10%
Blue - 25%
Green - 7%
Yellow - 58%

I then declare a random which selects an item based off their percentage. So yellow is likely to be selected and green the least likely.

How would I go around doing that.

Viewing all articles
Browse latest Browse all 27078

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>