[Remind-Fans] Getting reminders at random
Neal Fultz
nfultz at gmail.com
Mon Mar 30 01:19:24 EDT 2020
I've added a new function to remind to call the C RNG, to be reminded of
things at a random date. I guess someone else asked about this in 2001?
Anyway, patch is here:
https://github.com/nfultz/remind/compare/nfultz/randint.patch
Please feel free to add it to the official release (or not, it's a little
buggy).
Here is how it works in practice:
nfultz at neal-nuc:Remind$cat test.rem
REM MSG '[randint(10)]' '[randint(10,20)]'%
REM [randint(28)] MSG random day of month%
REM SATISFY [randint(7) == $Tw] MSG random day of week.%
nfultz at neal-nuc:Remind$src/remind -n test.rem
2020/03/30 '3' '19'
2020/04/20 random day of month
2020/04/11 random day of week.
nfultz at neal-nuc:Remind$src/remind -n test.rem
2020/03/30 '4' '20'
2020/04/23 random day of month
2020/04/01 random day of week.
I don't quite get why 4/11 would be chosen by SATISFY in the first run,
wouldn't 4/4 be the next Saturday? Perhaps the expression is reevaluated
and advancing the RNG, iterating past 4/4 and essentially doing rejection
sampling with p=1/7 ? Could be a defect in my implementation of randint, or
my understanding of SATISFY.
Anyways, thanks for the very useful program.
vr
Neal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://dianne.skoll.ca/pipermail/remind-fans/attachments/20200329/ce9cb106/attachment.htm>
More information about the Remind-fans
mailing list