rsyslog-8.2302.0
A ruleset contains a piece of code supposed to chose somehting at random.
At first it was like this:
set $.set = "abcd";
set $.len = strlen($.set);
set $.n = random($.len);
set $.choice = substring($.set,$.len,1);
But I was afraid that random() could not be perfectly uniform with such
small range so I did the usual trick and replaced it with
set $.n = random(30000) % $.len;
And...
I stopped getting "c" as a result. Completely. I know it's not supposed
to be a crypto-grade random number generator but skewed this much?
I lowered the limit for random to 3000 and it seems it distributes my
values pretty uniformly now
MK
_______________________________________________
rsyslog mailing list
https://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards
NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of
sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE
THAT.