52 char bufa[256], bufb[256];
60 debugs(28, 5,
"aclParseRandomData: " << t);
65 if (sscanf(t,
"%[0-9]:%[0-9]", bufa, bufb) == 2) {
68 if (a <= 0 || b <= 0) {
73 }
else if (sscanf(t,
"%[0-9]/%[0-9]", bufa, bufb) == 2) {
76 if (a <= 0 || b <= 0 || a > b) {
81 }
else if (sscanf(t,
"0.%[0-9]", bufa) == 1) {
99 static std::mt19937 mt;
100 static std::uniform_real_distribution<> dist(0, 1);
102 const double random = dist(mt);
104 debugs(28, 3,
"ACL Random: " <<
name <<
" " <<
pattern <<
" test: " <<
data <<
" > " << random <<
" = " << ((
data > random)?
"MATCH":
"NO MATCH") );
105 return (
data > random)?1:0;
int xatoi(const char *token)
bool valid() const override
bool empty() const override
int match(ACLChecklist *checklist) override
Matches the actual data in checklist against this Acl::Node.
void parse() override
parses node representation in squid.conf; dies on failures
SBufList dump() const override
char const * typeString() const override
static char * strtokFile()
A const & min(A const &lhs, A const &rhs)
#define DBG_PARSE_NOTE(x)
#define debugs(SECTION, LEVEL, CONTENT)
std::list< SBuf > SBufList