當前位置:編程學習大全網 - 電腦編程 - 請問如何用PHP生成50萬個不重復的8位阿拉伯數字?

請問如何用PHP生成50萬個不重復的8位阿拉伯數字?

& lt?服務器端編程語言(Professional Hypertext Preprocessor的縮寫)

函數singelRand(){

$ chars = " 1234567890 ";

$ string =

for($ I = 0;$ i & lt8;$i++){

srand((double)microtime()* 1000000);

$rand=rand(0,strlen($ chars)-1);

$string。=substr($chars,$rand,1);

}

返回$ string

}

函數產生50W(){

$ count = 50000

$ result = array();

for($ I = 0;$ i & lt$ count$i++){

array_push($result,singel rand());

}

返回$ result

}

$ a = produce 50w();

print _ r($ a);

& gt

  • 上一篇:求java編程,要求輸入三個數後,輸出這三個數中最大的數
  • 下一篇:如何用通達信選擇月線周線MACD向上的股票
  • copyright 2024編程學習大全網