- Make sure no one has a card that he has 0% chance of having while ensuring the others are evenly distributes
To make a 0% chance for some cards to be dealt, simply remove those cards as options. E.g.
IList<int> cardOptions = Enumerable.Range(1, 52).ToList();
// all 52 cards in this deck represented as integers
// remove some:
cardOptions.Remove(5);
cardOptions.Remove(42);
// when you randomly select from cardOptions,
// each remaining card has a 1/50 probability of being chosen
2. (In a situation where some players have 10%, 40%, etc.. chance of having a card)
Make sure the cards are distrubuted acording to their weights. Eg: A player has to choose 3 cards, he has 2% chance of having A, K or Q and that's the only cards he has left to choose from (from 2 different suits)
This sounds different from a typical weighted random distribution. You could do the following (pseudocode):
double probabilityOfHavingCertainCard = 0.4;
int thatCard = 52;
if (randomDoubleBetween0and1 < probabilityOfHavingCertainCard)
cardResults.Add(thatCard);
cardOptions.Remove(thatCard);
while (cardResults.Count < 5)
cardResults.Add(random from cardOptions, not previously chosen);
That is, it treats the weighted card as a special case, not as part of the ordinary shuffle of the hand.