var w,h,my={};function probmatchMain(){var version='0.61';w=440;h=180;my.opts={popN:30,choiceN:365} var s='';s+='' s+='
';s+='
';s+='
Population:
';s+='';s+='
';s+='
';s+='
Available Choices:
';s+='';s+='
';s+='
';s+='';s+='
' s+='
';s+='' s+='
' s+='
© 2020 MathsIsFun.com v'+version+'
';s+='
';document.write(s);document.getElementById('choiceN').value=optGet('choiceN') document.getElementById('popN').value=optGet('popN')} function doIt(){var listLen=1000 var popN=parseInt(document.getElementById('popN').value) if(isNaN(popN))popN=0 optSet('popN',popN) var choiceN=parseInt(document.getElementById('choiceN').value) if(isNaN(choiceN))choiceN=0 optSet('choiceN',choiceN) var s='' if(isNaN(popN)||popN<1||popN>100||choiceN<1||choiceN>1000){s='choose a population between 1 and 100, and choices between 1 and 1000'}else{var res=listGet(listLen,popN,choiceN) s+='Population: '+popN+', Available Choices: '+choiceN s+='\n' s+='Number of trials: '+listLen s+='\n' s+='\n' s+='Has Matches = '+res.dupN+'/'+listLen+' = '+res.dupN/listLen s+='\n' s+='\n' s+=res.s} document.getElementById('list').value=s} function listGet(listLen,popN,choiceN){var dupN=0 var s='' for(var i=0;i0)s+=',' s+=num.toString() for(var k=0;k