I have a function that I want to call within a random range in Node. So, for instance, I would like it to be executed once between 2 and 12 hours, then again once between 2 and 12 hours, and so on. However, this interval should not be fixed, so I need that interval to be recalculated at the end of every call.
If possible, I'd also like to limit the days of the week that this can execute, so not on Saturdays and Sundays as an example.
I've tried looking into later.js, which does the second part very well, but I can't seem to find a way to incrementally randomize the interval. Does anyone know how to accomplish this?
I must admit to not being an later.js expert but isn't custom time periods what you are after?