Skip to content

Instantly share code, notes, and snippets.

@hughfdjackson
Forked from anonymous/gist:1674197
Created January 25, 2012 02:22
Show Gist options
  • Select an option

  • Save hughfdjackson/1674220 to your computer and use it in GitHub Desktop.

Select an option

Save hughfdjackson/1674220 to your computer and use it in GitHub Desktop.
kayseebee - pastebin.com/m8jye8Y0
<script type="text/javascript">
var counter = 0;
function execLot()
{
var grpNums1 = new Array(1,2,3,4,5,6,7,8,9,10);
var index1 = Math.floor(Math.random()*grpNums1.length);
var grpNums2 = new Array(1,2,3,4,5,6,7,8,9,10);
var index2 = Math.floor(Math.random()*grpNums2.length);
var match = false;
while (match == false)
{
if (grpNums1[index1] == grpNums2[index2])
{
match = true;
alert("You won!");
}
else
{
match = false;
counter++;
}
}
}
function execStopSim()
{
alert("The simulator ran " + counter + " times.");
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment