summaryrefslogblamecommitdiffstats
path: root/lib/uuid.js
blob: e8d9c6cff99522b343a7612099bf1b18e9a8b992 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
















                                                                                       
var CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');

var generate = function(len) {
    var uuid = [];

    len = len || 14;
    for (i = 0; i < len; i++) {
        uuid[i] = CHARS[0 | Math.random()* CHARS.length];
    }

    return uuid.join('');
};

module.exports = {
    generate: generate
};