Node.js examples for Number:Random Number
Get a random hex value
/**/*from ww w . java 2s. c om*/ * Get a random hex value * * @returns {string} hex string */ function getRandomHex(length) { if (length === void 0) { length = 16; } var name = ''; do { name += Math.round(Math.random() * Math.pow(16, 8)).toString(16); } while (name.length < length); return name.substr(0, length); }