lib/utility/array.js
/** Returns a random element from an array, which is not equal `prev` */
Returns a random element from an array, which is not equal `prev`
Returns a random element from an array which is not equal ` prev `
function selectNext(prev, arr) {
  var equals = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (a, b) {
    return a === b;
  };
  var next = randomSelect(arr); 
  if (equals(prev, next)) {
    return selectNext(prev, arr);
  }
  return next;
}
function selectNext ( prev , arr ) { var equals = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : function ( a , b ) { return a === b ; } ; var next = randomSelect ( arr ) ; if ( equals ( prev , next ) ) { return selectNext ( prev , arr ) ; } return next ; }
Returns a random element from an array, which is not equal `prev`
Returns a random element from an array which is not equal ` prev `
// TODO infinite loop if arr is empty