Skip to content

Instantly share code, notes, and snippets.

@bjarneo
Last active August 29, 2015 14:18
Show Gist options
  • Save bjarneo/2c6932113b0d4589b151 to your computer and use it in GitHub Desktop.
Save bjarneo/2c6932113b0d4589b151 to your computer and use it in GitHub Desktop.
a/b javascript
var r = 0,
len = 1000000,
a = 0, b = 0;
while (len--) {
r = Math.floor(Math.random() * 2) + 1;
if (r === 1) {
a++;
} else {
b++;
}
}
console.table([['a', a], ['b', b]]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment