Given a probability (here is the number of points), determine whether an event occurred.
can be used in accordance with the number of points earned by the user, randomly generated site lucky Star and other aspects (note: There is a word).
/**
@title:P hp Lucky Star (Lucker)
@version: 1.00
@license: BSD
@author: Axgle
*/
$BL = Lucker (50); possibility of//50%
Var_dump ($BL);
function Lucker ($dot) {
$dot = Intval ($dot);
$dot = max ($dot, 0);//min dot = 0
$dot = min ($dot, +);//max dot = 100
$one = rand (1,100);
$total = range (1,100);
Shuffle ($total);
$range = Array ();
for ($i =0; $i < $dot; $i + +) {
$range [] = $total [$i];
}
Return In_array ($one, $range);
}
?>
http://www.bkjia.com/PHPjc/508501.html www.bkjia.com true http://www.bkjia.com/PHPjc/508501.html techarticle given a probability (here is the number of points), determine whether an event occurred. Can be used in accordance with the number of points earned by users, randomly generated sites such as the Lucky Star (note: there is a word). PHP/* ...