Sha256: 3879b7587b442c645f13b4ed522acc727f1918b7a0d65a905f08ccc6ce35c381
Contents?: true
Size: 761 Bytes
Versions: 69
Compression:
Stored size: 761 Bytes
Contents
var randHex = require('./randHex'); var choice = require('./choice'); /** * Returns pseudo-random guid (UUID v4) * IMPORTANT: it's not totally "safe" since randHex/choice uses Math.random * by default and sequences can be predicted in some cases. See the * "random/random" documentation for more info about it and how to replace * the default PRNG. */ function guid() { return ( randHex(8)+'-'+ randHex(4)+'-'+ // v4 UUID always contain "4" at this position to specify it was // randomly generated '4' + randHex(3) +'-'+ // v4 UUID always contain chars [a,b,8,9] at this position choice(8, 9, 'a', 'b') + randHex(3)+'-'+ randHex(12) ); } module.exports = guid;
Version data entries
69 entries across 69 versions & 2 rubygems