Edit in JSFiddle

var students = [ "Niall", "Stuart", "Martin", "Eduard", "Shane", "Eoin", "Obi", "Joseph", "Ciaran", "Darragh", "John", "Brian", "Dave", "Henry" ]

var shuffleAndGroup = ( students, sizeGroups=2) => {
	var shuffled = students.sort( () => (.5-Math.random()) )
	var grouped = shuffled.reduce( ( acc, current, index ) => {
		index%sizeGroups? acc[acc.length-1].push(current) : acc.push([current]);
		return acc;
	},[])
	return grouped;
}

$("button").click(function() {
  var sizeGroup = $("select option:selected").val() || undefined;
  var shuffledAndGrouped = shuffleAndGroup(students,sizeGroup);
  console.clear();  console.info(shuffledAndGrouped.length + " groups of " + (sizeGroup || 2) + " members each")
  shuffledAndGrouped.forEach( ( current, index ) => {
    console.dir ( current )
  })
});