Namaste Rachel, Theo(s),

> Sent: Thursday, January 05, 2023 at 5:50 PM
> From: "Theo de Raadt" <dera...@openbsd.org>
> To: "Theo Buehler" <t...@theobuehler.org>
> Cc: "Rachel Roch" <rr...@tutanota.de>, "Misc" <misc@openbsd.org>
> Subject: Re: Is CRONTAB(5) random really random ?
>
> Theo Buehler <t...@theobuehler.org> wrote:
> 
> > On Thu, Jan 05, 2023 at 06:15:43PM +0100, Rachel Roch wrote:
> > > According to the docs :
> > > 
> > > > A random value (within the legal range) may be obtained by using    the 
> > > > ‘~’ character in a field.
> > 
> > The random numbers are drawn once and then repeated regularly. This
> > behavior has always bothered me but never enough to spend the time
> > needed to fix it (it's not immediately obvious how to do it). A
> > workaround is to use a 
> > 
> >     sleep $((RANDOM \% 512)) && run_whatever
> > 
> > construct. The number to the right of the modulo should be a power of 2
> > to avoid modulo bias.
> 
> Any solution would need to be careful, so that a operation doesn't run
> multiple times in an hour.  Each column should be '0 + random % range',
> but multiple columns contain ~, it gets weird.
> 
> 

The following thread may be helpful:

"Regarding randomized times in crontab"
https://marc.info/?l=openbsd-misc&m=158705405304672&w=2

Dhanyavaad,
Dharma Artha Kama Moksha

Reply via email to