Re: [exim] Random numbers

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Jakob Hirsch
Datum:  
To: Ian Eiloart
CC: exim-users
Betreff: Re: [exim] Random numbers
Ian Eiloart wrote:

> Does Exim have a random number generator?


Recent versions have the modulo operator, so you can build yourself a poor
man's RNG:
${if eq{${eval:($tod_epoch+$pid)%2}}{0}}

will give you true with a 50% (= 0.5 = reciprocal value of 2) chance (over
a sufficent long period). That's much less expensive than a regex, I'd
say.
Note that messages received within the same second over the same
connection will have the same value assigned, but that's typically not a
problem with spam.