全部源码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>概率</title>
<script>

var cardType = [‘1′,’2′,’3′,’4′,’5’];
var cardNum = [9,19,46,21,9];   //概率 分别是多少.
document.write(playCard(cardType, cardNum));

 

function playCard(cardType, cardNum){
        var cards = [];
        for(var i = 0; i < cardType.length; i++){
                cards.push.apply(cards, new Array(cardNum[i]+1).join(cardType[i]).split(”));
        }
        for(var i = 0; i < 10; i++){  //可以多洗几次牌
               cards.sort(function(){return Math.random()>0.5?1:-1});
        }
        return cards; //洗好的牌
}
</script>
</head>
<body  >

       

</body>
</html>