A friend said his friend shouted questions. Lottery store, want to print out a list.
There are 22 balls numbered 1-22, from which 5 are randomly taken out. Take it out and don't put it back.
For example, the first time I took out is the number 5, the second is from the remaining 21 balls to take. And so on, take 5 balls out altogether.
Take out the last 5 balls, arrange the order regardless, that is to take out is 1 2 3 4 5 and 5 4 3 2 is the same number, print out the list can only come out once
Finally, print out all the results. He called the simple permutation of the problem, involving the array of some operations, I temporarily lost my mind to think.
See if there is a big answer, to provide some more convenient algorithm, thank you very much
<script> var a=[] var b=[] var n for (var i=1;i<23;i++) A.push (i<10? "0" +i:i) for (var i=0;i<5;i++) {n = a.splice (Math.floor (Math.random () * a.length), 1) alert ("Extract: + N") B.pu SH (N)} alert ("Total Extraction:" +b.sort () + "still left:" +a) </script>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
<script language= "JAVAScript" > Function combination (//full combination MSTR,//source character Mlen//element number) {//Return processing success var vresult = ""; function pcombination (//full combination subroutine Mleft,//arrange to left character mright//align to right character) {if (mleft.length >= mlen) Vresult + = Mleft + "\ n"; else for (var I = 0; I < Mright.length; i++) pcombination (Mleft + mright.substr (i, 1), mright.substr (i + 1, mright.length)); } pcombination ("", MSTR); return vresult; }/* Combination/alert (combination ("12345", 3)); </script>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]