Source: apc-static/lib/uuid/s4.js

/**
 * Generate UUID s4
 * @function lib.uuid.s4
 * @author Taka Okunishi
 *
 */
module.exports = function () {
    return Math.floor((1 + Math.random()) * 0x10000)
        .toString(16)
        .substring(1);
};