ab_test_selecting
Select an option from the list, particularly a/b test.
Use only Math.random is wrong because the function is nondeterministic
You can see distribution and you may be modify him
Getting Started
Installing
npm install ab_test_selecting@latest -S
Examples
const AbTestSelecting = require('ab_test_selecting.js');
const abTestSelecting = new AbTestSelecting({
page_something: {
variations: [{
name: "first",
ratio: 25,
visited: 0,
}, {
name: "two",
ratio: 60,
visited: 0,
}, {
name: "three",
ratio: 15,
visited: 0,
}]
}
});
var page, variant;
for (var i = 0; i < 274; i++) {
var res = abTestSelecting.choice('page_something');
if (res instanceof Error) {
throw res;
}
({ page, variant } = res);
}
console.log(page);
console.log(variant);
Running the tests
npm run test