Skip to content

Instantly share code, notes, and snippets.

@msteckyefantis
Last active June 12, 2016 19:37
Show Gist options
  • Save msteckyefantis/5d5d662bd5d09eddee7c0418a710bbd7 to your computer and use it in GitHub Desktop.
Save msteckyefantis/5d5d662bd5d09eddee7c0418a710bbd7 to your computer and use it in GitHub Desktop.
Super Mysterious Math!!!
'use strict';
var M = Math;
var L = [ 0, 0 ];
function F() {
return M.floor( 2 * M.random() ) ? 'head' : 'tail';
}
function C() {
if( F() === 'head' ) {
L[0]++;
}
else{
L[1]++;
}
}
for( var i = 0; i < 1000000; i++ ) {
C();
}
console.log( L );
/*
[ 499330, 500670 ]
[ 500252, 499748 ]
[ 499094, 500906 ]
[ 499657, 500343 ]
[ 500027, 499973 ]
[ 499850, 500150 ]
[ 499265, 500735 ]
[ 500282, 499718 ]
[ 499473, 500527 ]
[ 499963, 500037 ]
*/
@msteckyefantis
Copy link
Author

msteckyefantis commented Jun 12, 2016

See vandium for AWS Lambda code security and validation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment