js 概率計算(簡單版)
來源:懂視網
責編:小采
時間:2020-11-27 22:30:32
js 概率計算(簡單版)
js 概率計算(簡單版):核心代碼: //7:3運算 if(Math.ceil(Math.random()*10)>3){ //占比=7 alert('7'); window.location.href=http://www.baidu.com rel=external nofollow ; }else{ //占比=3 alert(3); widnow.lo
導讀js 概率計算(簡單版):核心代碼: //7:3運算 if(Math.ceil(Math.random()*10)>3){ //占比=7 alert('7'); window.location.href=http://www.baidu.com rel=external nofollow ; }else{ //占比=3 alert(3); widnow.lo

核心代碼:
//7:3運算
if(Math.ceil(Math.random()*10)>3){
//占比=7
alert('7');
window.location. rel="external nofollow" ;
}else{
//占比=3
alert(3);
widnow.location.;
}
通過隨機數大小來判斷,最好訪問哪個網址。大家可以根據自己的需求修改即可。
聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com
js 概率計算(簡單版)
js 概率計算(簡單版):核心代碼: //7:3運算 if(Math.ceil(Math.random()*10)>3){ //占比=7 alert('7'); window.location.href=http://www.baidu.com rel=external nofollow ; }else{ //占比=3 alert(3); widnow.lo