red:11
black:17
white:14
-->
<html>
<body>
<script type="text/javascript">
for(var red=0red<=25red++)
{
var white=25-red,black=28-red
if(31==white+black)
{
alert("red:"+red+"\n"+"black:"+black+"\n"+"white:"+white)
}
}
</script>
</body>
</html>
<html><head>
<title>test</title>
<meta http-equiv="content-Type" content="text/htmlcharset=utf-8">
<script type="text/javascript">
var unique = {}
window.onload = function(){
document.getElementById('btn').onclick = function(){
var result = random_num([6,1])
document.getElementById('result').innerHTML = document.getElementById('result').innerHTML + '<br />' + result
unique = {}
}
}
function random_num(){
var params = arguments[0]
var count = params[0] + params[1]
var result = arguments[1] || []
var k = ("0"+Math.floor(Math.random() * (result.length >= params[0] ? 16 : 33) + 1)).slice(-2)
if(result.length<count){
if(!unique[k]){
result.push(k)
unique[k] = 1
}
random_num(params,result)
}
return result.slice(0,count-params[1]).sort().concat(result.slice(params[0]).sort())
}
</script>
<body>
<button id="btn">result</button>
<div id="result"></div>
</body>
</html>