Konstantinos-infogeek
3/12/2012 - 11:08 PM

javascript

javascript

function jokerNumbers(bc,sc, choice){
	 bc = (bc && !isNaN(bc)) ? parseInt(bc)+1 : 46;
	 sc = (sc && !isNaN(sc)) ? parseInt(sc) : 20;
	 choice = (choice && !isNaN(choice)) ? choice : 5;
	  if(bc && sc && choice){
		  var arr = Array(bc), jk = [],counter=0;
		 
		  while(counter!=choice){
			  
		  randomNumber = Math.ceil(Math.random()*arr.length);		
					  
					  if(!arr[randomNumber]){
						  arr[randomNumber] = randomNumber;
						  counter++;			
					  }
		  }
		  for(var i=0 , y=0; i<arr.length; i++){
			   if(arr[i]){ jk[y] = arr[i]; y++}
			  }
			  
		  jk[jk.length] = Math.ceil(Math.random()*sc);
	
	return jk;} else { return false;}
  }