每当我的应用选择“随机”牌时,它总是遵循相同的奇怪模式:只有梅花 1-3,方块 4-6,红心 7-9,黑桃 10-12。西装总是在那个数字范围内,永远不会改变。每个套房应该被允许去13!请帮我解决一些令人困惑的问题,谢谢!
来源:
Random Suite = new Random();
Random Value = new Random();
int sprod;
int vprod;
public Card RandomCardDraw()
{
sprod = Suite.Next(1, 5);
Card newc = new Card();
newc.x = sprod;
vprod = Value.Next(1, 13);
if (sprod == 1)
{
newc.suite = CardSuites.Club;
newc.y = vprod;
switch (vprod)
{
case 1:
newc.cardval = CardValues.Ace;
return newc;
case 2:
newc.cardval = CardValues.Two;
return newc;
case 3:
newc.cardval = CardValues.Three;
return newc;
case 4:
newc.cardval = CardValues.Four;
return newc;
case 5:
newc.cardval = CardValues.Five;
return newc;
case 6:
newc.cardval = CardValues.Six;
return newc;
case 7:
newc.cardval = CardValues.Seven;
return newc;
case 8:
newc.cardval = CardValues.Eight;
return newc;
case 9:
newc.cardval = CardValues.Nine;
return newc;
case 10:
newc.cardval = CardValues.Ten;
return newc;
case 11:
newc.cardval = CardValues.Jack;
return newc;
case 12:
newc.cardval = CardValues.Queen;
return newc;
case 13:
newc.cardval = CardValues.King;
return newc;
}
}
if (sprod == 2)
{
newc.suite = CardSuites.Diamond;
newc.y = vprod;
switch (vprod)
{
case 1:
newc.cardval = CardValues.Ace;
return newc;
case 2:
newc.cardval = CardValues.Two;
return newc;
case 3:
newc.cardval = CardValues.Three;
return newc;
case 4:
newc.cardval = CardValues.Four;
return newc;
case 5:
newc.cardval = CardValues.Five;
return newc;
case 6:
newc.cardval = CardValues.Six;
return newc;
case 7:
newc.cardval = CardValues.Seven;
return newc;
case 8:
newc.cardval = CardValues.Eight;
return newc;
case 9:
newc.cardval = CardValues.Nine;
return newc;
case 10:
newc.cardval = CardValues.Ten;
return newc;
case 11:
newc.cardval = CardValues.Jack;
return newc;
case 12:
newc.cardval = CardValues.Queen;
return newc;
case 13:
newc.cardval = CardValues.King;
return newc;
}
}
if (sprod == 3)
{
newc.suite = CardSuites.Heart;
newc.y = vprod;
switch (vprod)
{
case 1:
newc.cardval = CardValues.Ace;
return newc;
case 2:
newc.cardval = CardValues.Two;
return newc;
case 3:
newc.cardval = CardValues.Three;
return newc;
case 4:
newc.cardval = CardValues.Four;
return newc;
case 5:
newc.cardval = CardValues.Five;
return newc;
case 6:
newc.cardval = CardValues.Six;
return newc;
case 7:
newc.cardval = CardValues.Seven;
return newc;
case 8:
newc.cardval = CardValues.Eight;
return newc;
case 9:
newc.cardval = CardValues.Nine;
return newc;
case 10:
newc.cardval = CardValues.Ten;
return newc;
case 11:
newc.cardval = CardValues.Jack;
return newc;
case 12:
newc.cardval = CardValues.Queen;
return newc;
case 13:
newc.cardval = CardValues.King;
return newc;
}
}
if (sprod == 4)
{
newc.suite = CardSuites.Spade;
newc.y = vprod;
switch (vprod)
{
case 1:
newc.cardval = CardValues.Ace;
return newc;
case 2:
newc.cardval = CardValues.Two;
return newc;
case 3:
newc.cardval = CardValues.Three;
return newc;
case 4:
newc.cardval = CardValues.Four;
return newc;
case 5:
newc.cardval = CardValues.Five;
return newc;
case 6:
newc.cardval = CardValues.Six;
return newc;
case 7:
newc.cardval = CardValues.Seven;
return newc;
case 8:
newc.cardval = CardValues.Eight;
return newc;
case 9:
newc.cardval = CardValues.Nine;
return newc;
case 10:
newc.cardval = CardValues.Ten;
return newc;
case 11:
newc.cardval = CardValues.Jack;
return newc;
case 12:
newc.cardval = CardValues.Queen;
return newc;
case 13:
newc.cardval = CardValues.King;
return newc;
}
}
else
{
return newc;
}
return newc;
}