I have working algorithm on my own project and I need it to be uploaded on jsfiddle and working as expected. The bad thing is I have no idea how to use crypto module to work there.
this.getOffset = function(forcedOffset){
return Bluebird.try(function () {
if (forcedOffset != undefined) return forcedOffset;
return CryptoJS.randomBytes(4);
}).then(function (randomBytes) {
var random = Number.parseInt(randomBytes.toString('hex'), 16) / 4294967295;
var maxVal = 1000000;
return Math.floor(random * maxVal);
});
};
and for my project I'm just requiring it, but how to handle this situation here?

