Random Assignment - dan7davis/Lambda GitHub Wiki
Randomly Assigning Learners to Experimental Conditions
- Locate the learner's edX ID in the DOM
var domID = analytics.user()._getId();
- Use Modulo operator to assign learners into cohorts.
if (userid % 2 == 1) {
// What learners with ODD userID's should see;
} else {
// What learners with EVEN userID's should see
}
This can be used for assignment for any number of cohorts by changing the value after the %
operator to the number of desired cohorts.