日期:2014-05-16 浏览次数:20441 次
var b1,b2,b3,b4,b5;
for(var i=1;i < 4;){
b1=Math.round(Math.random());
b2=Math.round(Math.random());
b3=Math.round(Math.random());
b4=Math.round(Math.random());
b5=Math.round(Math.random());
if (b1 == 0 && b2 == 0) {
console.log();//输出b1-b5的值
i ++;
}
}
var _al,
_count = 0;
for(;;){
_al = [
Math.round( Math.random() ),
Math.round( Math.random() ),
Math.round( Math.random() ),
Math.round( Math.random() ),
Math.round( Math.random() )
];
if( _al[ 0 ] == 0 && _al[ 1 ] == 0 ){
console.log( _al.join("") );
if( ++_count >= 3 ){ break; };
};
};
var arr = [];
while(arr.length<3)
{
var n = ((~~(Math.random()*32))
------解决方案--------------------
32).toString(2).replace(/./g,",$&").slice(3);
if(n.indexOf("0,0")==0)
arr.push(n);
}
alert(arr.join(";"));
for(var i=0; i<3; i++) {
document.write('第'+(i+1)+'组:');
document.write('0');
document.write('0');
document.write(Math.round(Math.random()));
document.write(Math.round(Math.random()));
&n