效果:
Click the button to display a random testing order
给耳机音响发烧友一键生成盲听铜铁抓阄纸条,不用安装任何软件 点击生成
Click the button to display a random testing order
Try it
铜___1
铜___2
铜___3
铁__1
铜___4
铁__2
铁__3
铜___5
铁__4
铜___6
铁__5
铜___7
铁__6
铁__7
铁__8
铜___8
铜___9
铁__9
铁__10
铜___10
代码如下:
亲手打的代码。 亲测无误。
这是生成 20 次盲听的代码。
<!DOCTYPE html>
<html>
<body>
<p>Click the button to display a random testing order</p>
<p> 给耳机音响发烧友一键生成盲听铜铁抓阄纸条,不用安装任何软件 点击生成</p>
<button onclick = "myRandomSTR()">Try it</button>
<br>
<br>
<p id="Result_Demo"></p>
<br>
<br>
<script>
function myRandomSTR() {
var ls_tmp =""; var li_i, li_j; var li_tmp = 0;
var ld_myRand = 0;
var li_a, li_b;
do {
ls_tmp = ""; li_a = 1; li_b = 1;
for (li_i = 0; li_i < 20; li_i++) {
for (li_j = 0; li_j < 50; li_j++ ) {
li_tmp = ( Math.random() - 0.5 ) * 68719476736;
ld_myRand = li_tmp / 68719476736;
}
ls_tmp += (ld_myRand >0) ? ("铁__" + String (li_a++) + "<br>" ) : ( "铜___" + String (li_b ++) + "<br>" );
}
} while (li_a != li_b);
document.getElementById("Result_Demo").innerHTML = ls_tmp;
//ls_tmp = null;
}
</script>
如果您一个字都不想打, 那么复制粘贴下面的代码,另存为一个 HTML 文件,
就可以生成 100 次盲听。
<!DOCTYPE html>
<html>
<body>
<p>Click the button to display a random testing order</p>
<p> 给耳机音响发烧友一键生成盲听铜铁抓阄纸条,不用安装任何软件 点击生成</p>
<button onclick = "myRandomSTR()">Try it</button>
<br>
<br>
<p id="Result_Demo"></p>
<br>
<br>
<script>
function myRandomSTR() {
var ls_tmp =""; var li_i, li_j; var li_tmp = 0;
var ld_myRand = 0;
var li_a, li_b;
do {
ls_tmp = ""; li_a = 1; li_b = 1;
for (li_i = 0; li_i < 100; li_i++) {
for (li_j = 0; li_j < 50; li_j++ ) {
li_tmp = ( Math.random() - 0.5 ) * 68719476736;
ld_myRand = li_tmp / 68719476736;
}
ls_tmp += (ld_myRand >0) ? ("铁__" + String (li_a++) + "<br>" ) : ( "铜___" + String (li_b ++) + "<br>" );
}
} while (li_a != li_b);
document.getElementById("Result_Demo").innerHTML = ls_tmp;
//ls_tmp = null;
}
</script>