Sha256: 24c157acce7d7454e1c1128ea88e2c915269b00f12825d39fa8ebe5b8ff754f3
Contents?: true
Size: 747 Bytes
Versions: 69
Compression:
Stored size: 747 Bytes
Contents
define(['./randHex', './choice'], function (randHex, 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) ); } return guid; });
Version data entries
69 entries across 69 versions & 2 rubygems