Live Brilliant

비율(%)에 따른 설치? 또는 비율(%)만큼 누락하려면.. 본문

개발은 핵찜이야/PHP

비율(%)에 따른 설치? 또는 비율(%)만큼 누락하려면..

주인정 2012. 4. 13. 17:06
 
비율(%)에 따른 설치? 또는 비율(%)만큼 누락하려면..

$iUpercent = 20; // 20%
for($i=0;$i<1000;$i++) {

if( rand()%101 < $iUpercent ) //전체 랜덤
{

$uCount++;

}

}

echo $uCount;

 

Comments