<?php
function paranoid_rand($min = 0, $max = 0x7FFFFFFF) {
global $COUNTER;
$diff = $max - $min;
if ($diff < 0 || $diff > 0x7FFFFFFF) {
throw new RuntimeException("Bad range");
}
if ($bytes === false || strlen($bytes) != 8) { echo "Unable to get 8 truly random bytes, trying again in 3 seconds<br/>";
return paranoid_rand($min, $max);
}
else
{
$ary = unpack("Nint", $bytes); $val = $ary['int'] & 0x7FFFFFFF; // 32-bit safe
$fp = (float) $val / 2147483647.0; // convert to [0,1]
$COUNTER++;
echo "Got a SuperRandom Value #".$COUNTER."<br />";
return round($fp * $diff) + $min; }
}
$anonDice1 = paranoid_rand(1,6); /* первый бросок человека */
$anonDice2 = paranoid_rand(1,6);/* второй бросок человека */
$compDice1 = paranoid_rand(1,6); /* первый бросок компа */
$compDice2 = paranoid_rand(1,6);/* второй бросок компа */
echo '<hr />';
echo "У человека выпало $anonDice1 и $anonDice2\nУ компа $compDice1 и $compDice2\n";
$anonSum = ($anonDice1 + $anonDice2);
$compSum = ($compDice1 + $compDice2);
if (($anonDice1 == $anonDice2 ) && ($compDice1 == $compDice2)){
echo " 2 дабла - тебя ждет большая удача. Запости скриншот!!\n";
if ($anonSum > $compSum ) {
echo "Победил человек с результатом $anonSum, у компъютера всего $compSum \n";
} else {
echo " KILL ALL HUMANS \n";
}
}
?>
PD9waHAKaW5pX3NldCgnbWF4X2V4ZWN1dGlvbl90aW1lJywxODApOwpmdW5jdGlvbiBwYXJhbm9pZF9yYW5kKCRtaW4gPSAwLCAkbWF4ID0gMHg3RkZGRkZGRikgewpnbG9iYWwgJENPVU5URVI7CiAgICAkZGlmZiA9ICRtYXggLSAkbWluOwogICAgaWYgKCRkaWZmIDwgMCB8fCAkZGlmZiA+IDB4N0ZGRkZGRkYpIHsKCXRocm93IG5ldyBSdW50aW1lRXhjZXB0aW9uKCJCYWQgcmFuZ2UiKTsKICAgIH0KICAgICRieXRlcyA9IG1jcnlwdF9jcmVhdGVfaXYoOCwgTUNSWVBUX0RFVl9SQU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