randHex.js
364 Bytes
var choice = require('./choice');
var _chars = '0123456789abcdef'.split('');
/**
* Returns a random hexadecimal string
*/
function randHex(size){
size = size && size > 0? size : 6;
var str = '';
while (size--) {
str += choice(_chars);
}
return str;
}
module.exports = randHex;