I'm not sure what is going on... all i know is that i'm getting same random numbers set after refreshing the page even when i shouldn't have to. here is the php code:
i took this example from codecademy.com php lessons Looping the Loop.
<!DOCTYPE html>
<html>
<head>
<title>Coin Flips</title>
</head>
<body>
<p>We are going to flip a coin until we get three heads in a row!</p>
<?php
$headCount = 0;
$flipCount = 0;
while ($headCount < 13) {
$flip = rand(0,1);
$flipCount ++;
if($flip) {
$headCount ++;
// echo "<div class=\"coin\">H</div>";
}
else{
$headCount = 0;
//echo "<div class=\"coin\">T</div>";
}
}
echo "<p>It took {$flipCount} flips!</p>";
?>
</body>
</html>
at codecademy's compilator this code always gives me different answers but when i'm trying to do this with xampp i'm getting same numbers or set of same numbers after keep refreshing and i don't want it to be that way.
so the answer keeps repeating: It took 55 flips! than comes, It took 747 flips! 3649, 7072, 622, 1875 and all keeps repeating with the same order all the time if i refresh pages. i think it's catched values at xampp? I launched this script with chrome and firefox and i'm having same results same numbers and same order. so my random values not works and i'm very sad about this. i even have deleted whole browser cache history and still same results. any help? is my explanation clear enough? thanks!