Skip to content

Instantly share code, notes, and snippets.

@heyalexej
Created July 23, 2015 10:47
Show Gist options
  • Save heyalexej/5ad729db6f3711c36116 to your computer and use it in GitHub Desktop.
Save heyalexej/5ad729db6f3711c36116 to your computer and use it in GitHub Desktop.
// var s = document.createElement('script');
// s.type = 'text/javascript';
// // s.async = true;
// if (my fancy sampling condition) {
// js.src = "//remote-domain.com/script-1.js";
// } else {
// js.src = "//remote-domain.com/script-2.js";
// }
// document.head.appendChild(s);
function lol() {
var random = Math.random();
if (random < 0.5) {
console.log('chance 0.0-0.499');
} else if (random < 0.75) {
console.log('chance 0.50—0.7499');
} else {
console.log('chance 0.75–0.99');
}
}
var i = 0;
while (i < 10000) {
// 10K durchläufe
lol();
i++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment