var path = require("path");

var root = path.join(__dirname);
var dir_avatars = path.join(root, "./src/images/avatars"); //D:\dev\web\g2k\Componentes\src\lib\components\avatars\utilities.js
//const dir_avatars = "./../../../images/avatars";

var allAvatars = function (ctx) {
  var keys = ctx.keys();
  return keys.map(ctx);
}(require.context(dir_avatars, true, /.*/));

export function randomArray(arr) {
  var index = Math.round(Math.random() * (arr.length - 1));
  return arr[index];
}
export function randomAvatar() {
  return randomArray(allAvatars);
}