JSFiddle - React, Tailwind, and code Playground
JavaScript
$(document).ready(function(){
var x,t1,t2,tfinal;
t1 = performance.now();
for(x=0; x<10; x++)
{
calculate();
}
t2 = performance.now();
tfinal = (t2 - t1) / 1000;
console.log("Execution time: ",tfinal," seconds");
});
function calculate(){
var a,b,c,d,e,f,g,h,i,j,total;
do {
a=Math.floor((Math.random() * 9) + 1);
b=Math.floor((Math.random() * 9) + 1);
c=Math.floor((Math.random() * 9) + 1);
d=Math.floor((Math.random() * 9) + 1);
e=Math.floor((Math.random() * 9) + 1);
f=Math.floor((Math.random() * 9) + 1);
g=Math.floor((Math.random() * 9) + 1);
h=Math.floor((Math.random() * 9) + 1);
i=Math.floor((Math.random() * 9) + 1);
j=Math.floor((Math.random() * 9) + 1);
total=a+13*b/c+d+12*e-f-11+g*i/j-10;
}
while (total!=66);
console.log(""+total+"="+a+"+13*"+b+"/"+c+"+"+d+"+12*"+e+"-"+f+"-11+"+g+"*"+i+"/"+j+"-10");
}