node package manager
Easy sharing. Manage teams and permissions with one click. Create a free org »

pair-me-up

pair-me-up

Gives a range, each paired with one another

NPM

Usage

var pair = require('pair-me-up');
var pairs = pair(1, 30);
 
console.log(pairs);
// [[1, 5], [2, 17], [3, 2], [4, 10], ...] 

You can also shuffle the resulting pairs:

var pair = require('pair-me-up');
var pairs = pair(1, 5, true);
 
console.log(pairs);
// [[3, 2], [5, 1], [2, 5], [4, 2], ...] 

view on requirebin