How to generate random bytes in Node.JS
Easy! I discovered this recently and it is interesting to me. Here is a quick example:
const crypto = require('crypto');
console.log(crypto.randomBytes(1).toString("hex"));
console.log(crypto.randomBytes(2).toString("hex"));
console.log(crypto.randomBytes(4).toString("hex"));
console.log(crypto.randomBytes(8).toString("hex"));
console.log(