Update README.MD
[poolifier.git] / lib / util.js
1 /**
2 * Contains utility functions
3 * @author Alessandro Pio Ardizio
4 * @since 0.0.1
5 */
6
7 const uuid = require('uuid/v4')
8 /**
9 * Return an id to be associated to a node.
10 */
11 module.exports.generateID = () => {
12 return uuid()
13 }
14
15 module.exports.randomWorker = (collection) => {
16 const keys = Array.from(collection.keys())
17 return keys[Math.floor(Math.random() * keys.length)]
18 }