2 of 3 shortened shuffler

JavaScript 1 line shuffle

// globals
var deck = [];

// functions
function newDeck() {
  var a = [], i=52;
  while(i--)a[i]={value:i};
  return a;
}

// random range
function rand(min, max) {
  return Math.floor(Math.random()*(max-min+1)) + min
}

// xor swap by reference
function swap(x, y) {
  if (x === y) return;
  x.value ^= y.value;
  y.value ^= x.value;
  x.value ^= y.value;
}

// Convert deck to string.
function deckStr() {
  var out ='';
  for (var i = 0; i < deck.length; i++) {
    out += deck[i].value + '\n';
  }
  return out;
}

// shuffle without locals
function shuffle() {
  deck.map(function(){swap(deck[rand(0,51)],deck[rand(0,51)])});
}

// Main
(function main() {
  deck = newDeck();
  shuffle();
  console.log(deckStr());
})();