Random PeriodicInformInterval doesn't work as expected

George Chelidze george.chelidze at magticom.ge
Thu Mar 28 13:49:19 EDT 2019


Hi Dan,

On 3/28/19 9:24 PM, Dan Morphis wrote:

> why do you want an interval so low

Just for testing, I plan to put 1 hour +/- 20% in production.

> why do you want a random interval? Load?

Yes

> Looking through sandbox.js we see this:
>
> // Monkey-patch Math.random() to make it deterministic
> context.random = random;
> vm.runInContext("Math.random = random;", context);
> delete context.random;
>
> And random is defined as:
> function random() {
>   if (!state.rng)
>     state.rng = seedrandom(state.sessionContext.deviceId);
>
>   return state.rng();
> }
>
> random.seed = function(s) {
>   state.rng = seedrandom(s);
> }
>
> This means for that particular device id, you will always get the same
> "random" value

Ah, clear.  That means, it doesn't make any sense to bind this provision
to a preset which executes on "2 PERIODIC". I would tag a device as soon
as a "random" value is set for the first time and skip tagged devices
later. Does it sounds reasonable? If yes, this kind of "random" number
will work for me.

What if I need really random value in my provision? Any other way?

Thanks,

George Chelidze

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.genieacs.com/pipermail/users/attachments/20190328/7e8af96f/attachment.html>


More information about the Users mailing list