Revision: 40024
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 25, 2011 05:13 by kendsnyder
Initial Code
function probabilityMatch($inNumberOfEvents) { $max = min($inNumberOfEvents, mt_getrandmax()); if ($max > 0) { return (mt_rand(0, $max) == 1); } } // Example usage // if (probabilityMatch(10)) { // clean the cache 1 out of every 10 page requests // cleanCache(); // }
Initial URL
Initial Description
Initial Title
Do an action 1 out of every N page requests
Initial Tags
Initial Language
PHP