Skip to content

Instantly share code, notes, and snippets.

@jcxplorer
Created February 12, 2011 16:58
Show Gist options
  • Save jcxplorer/823878 to your computer and use it in GitHub Desktop.
Save jcxplorer/823878 to your computer and use it in GitHub Desktop.

Revisions

  1. jcxplorer revised this gist Feb 26, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion uuid.js
    Original file line number Diff line number Diff line change
    @@ -8,5 +8,5 @@ function uuid() {
    }
    uuid += (i == 12 ? 4 : (i == 16 ? (random & 3 | 8) : random)).toString(16);
    }
    return uuid.toUpperCase();
    return uuid;
    }
  2. jcxplorer revised this gist Feb 12, 2011. 1 changed file with 9 additions and 7 deletions.
    16 changes: 9 additions & 7 deletions uuid.js
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,12 @@
    var uuid = "", i, random;
    for (i = 0; i < 32; i++) {
    random = Math.random() * 16 | 0;
    function uuid() {
    var uuid = "", i, random;
    for (i = 0; i < 32; i++) {
    random = Math.random() * 16 | 0;

    if (i == 8 || i == 12 || i == 16 || i == 20) {
    uuid += "-"
    if (i == 8 || i == 12 || i == 16 || i == 20) {
    uuid += "-"
    }
    uuid += (i == 12 ? 4 : (i == 16 ? (random & 3 | 8) : random)).toString(16);
    }
    uuid += (i == 12 ? 4 : (i == 16 ? (random & 3 | 8) : random)).
    toString(16).toUpperCase();
    return uuid.toUpperCase();
    }
  3. jcxplorer created this gist Feb 12, 2011.
    10 changes: 10 additions & 0 deletions uuid.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    var uuid = "", i, random;
    for (i = 0; i < 32; i++) {
    random = Math.random() * 16 | 0;

    if (i == 8 || i == 12 || i == 16 || i == 20) {
    uuid += "-"
    }
    uuid += (i == 12 ? 4 : (i == 16 ? (random & 3 | 8) : random)).
    toString(16).toUpperCase();
    }