hoodwink.d enhanced

Sun Sep 25

Generate sorta-kinda-UUIDs in JavaScript with Prototype 1.4.0_pre6

function UUID() {
  return [4, 2, 2, 2, 6].map(function(length) {
    return $R(0, length, true).map(function() {
      return (Math.random() * 256).toString(16);
    }).join('');
  }).join('-');
}

/* UUID()
 * => "eea637ad-e840-dc78-8199-d1c176f3a170" */