Re: [exim] Random numbers

Góra strony
Delete this message
Reply to this message
Autor: Jakob Hirsch
Data:  
Dla: Ian Eiloart
CC: exim-users
Temat: 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.