Last active
January 4, 2017 16:21
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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