I am trying to create a random system that is also based on "weight" of the items that are supposed to be drawn at random but beyond how it should work I am not sure how to actually implement it or do it in a good manner. This is how it should work:
Say you have 10 items and every time you "roll" a random check it should pick say 4 out of these 10 items (and no duplicates).
But instead of just drawing 4 items out of the 10 at complete random I also want the 10 items to each have a "weight" in how likely (or unlikely) they will be drawn.
So say we have this "weight" value and it is a value between 0 and 10 where the higher the value is the higher the probability that this item will be drawn on the next random check so an item with a weight value of 7 has a higher chance to be drawn than one with a weight of 3 for example (it could also be the reverse if that would make more sense for some reason in calculations). Probably the value could even be negative so that an item is even less likely to be drawn than the "base value" of 0 for rare items etc. Or another way to do this if negative values would result in problems would perhaps be that the base value is say 5 and then more rare items have a lower value and more common a higher value. Not completely sure what is the best approach for it.
I wonder if anyone have any suggestions on how to go about making such a system or examples of such a system?
I started to make an example that I have attached but I only got so far before I started to have problems with how to actually implement the different weight on the items to have some be more or less likely to be drawn.