Skip to content

Instantly share code, notes, and snippets.

@m3talstorm
Last active January 4, 2017 16:21
Show Gist options
  • Save m3talstorm/821dbb7bd1ba5d180bdb2e46b88b4c75 to your computer and use it in GitHub Desktop.
Save m3talstorm/821dbb7bd1ba5d180bdb2e46b88b4c75 to your computer and use it in GitHub Desktop.
Generates a combination containing 26 true/false values that can be used for super basic AB testing
var AB = (function(id) {
var _id = "";
var ret = {};
for(var i = 0; i < 26; i++) {
var a = id ? id[i] : parseInt(Math.random() * 10);
var char = String.fromCharCode(97 + i);
ret[char] = !!(a % 2);
_id += a;
}
// The ID that generated this combination
ret.ID = _id;
return ret
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment