2015-11-24 30 views

回答

3
function func(){ 

    return Math.random() < 0.5 ? 0 : 100; 

} 
+0

在每個人羣中都有一個,它是你@RobG:p –

+0

只需要轉動'>'即可。 :-0 – RobG

+0

@RobG有些人只是想看世界燒 – Ramanlfc

1

沒有如果需要的話 - 只要做到這一點:

Math.floor(Math.random() * 2) * 100 
0
function vv() 
{ 
    if (Math.random() * 100 > 50) 
     return 100; 
    else 
     return 0; 
} 
相關問題