Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ////
- function flip($h, $t, $times) {
- if ($h + $t <= $times) {
- $a = mt_rand(0, 1);
- if ($a == 1) {
- return flip($h + 1, $t, $times);
- } else {
- return flip($h, $t + 1, $times);
- }
- } else {
- return $h . ',' . $t;
- }
- }
- /////
- function trial($l) {
- $ar = array(
- 'null'
- );
- for ($i = 1; $i <= $l; $i++) {
- array_push($ar, flip(0, 0, 29));
- }
- $countAr = array_count_values($ar);
- arsort($countAr);
- foreach ($countAr as $key => $value) {
- print "<b>$key</b>" . ": " . $value . "</br>";
- }
- }
- trail(500);
- ?>
- www.saikrishnadeep.com
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement