'use strict';

var os = require('os');
var utils = exports;

/**
 * Return all ip addresses of the machine
 * @return {Array} list containing ip address info
 */
utils.getHostIPs = function() {
  var ips = [];
  var ifaces = os.networkInterfaces();
  Object.keys(ifaces).forEach(function (ifname) {
    ifaces[ifname].forEach(function (iface) {
      ips.push(iface.address);
    });
  });
  return ips;
};

/**
 * Generates a random string of the given length using lowercase letters and digits
 * @param  {Number} [length=8] string length to generate
 * @return {String}            a random string
 */
utils.getRandomHexString = function(length) {
  var string = '';
  var chars = '0123456789ABCDEF';

  if (!length) {
    length = 8;
  }

  for (var i = 0; i < length; i++) {
    var randomNumber = Math.floor(Math.random() * chars.length);
    string += chars.substring(randomNumber, randomNumber + 1);
  }

  return string;
};

@@ -489,16 +489,173 @@
  digits%0A
+ * @example%0A * // returns something like 8AF1%0A * utils.getRandomHexString(4)%0A * @example%0A * // returns something like 0D41C8AF%0A * utils.getRandomHexString()%0A
  * @para

Enhance docs of utils