Well, we have already made the deck of cards, so now we need to shuffle it. You can feel free to copy this code if you are making a flash based card game yourself. Or even PHP as it would be pretty easy to port over.
![]() |
![]() |
![]() |
| 1 | function shuffleCards (array:Array):Array { | |
| 2 | var _length:Number = array.length, mixed:Array = array.slice (), i:Number, j:Number, k:Object; | |
| 3 | for (j = 0; j < _length; j++) { | |
| 4 | k = mixed[j]; | |
| 5 | mixed[j] = mixed[i = random (_length)]; | |
| 6 | mixed[i] = k; | |
| 7 | } | |
| 8 | return mixed; | |
| 9 | } | |
![]() |
![]() |
![]() |






