Question
Picking 7 Random "Cards"
I am wondering if the following code would yield essentially the same results as dealing 7 cards from a sufficiently shuffled deck:
var deck:Array = new Array();
for(var j:int = 0;j<52;j++){
deck.push(j);
}
var hand:Array=new Array();
var card:uint;
for(j = 0;j<7;j++){
card = int(Math.random()*deck.length);
hand.push(deck.splice(card,1));
}
If not it would be great to know:
1. Why?
2. How to get the desired results.
Cheers,
John
