3v4l.org

run code in 300+ PHP versions simultaneously
<?php $valeurs = range(1, 40); $proba = array_fill(1, 40, 0); for ($i = 0; $i < 10000; ++$i) { $tirage_tab = array_rand($valeurs, 10); foreach($tirage_tab as $key => $value) { $proba[$valeurs[$value]]++; } } asort($proba); echo "Proba : <br/>\n"; foreach($proba as $key => $value) { echo "$key : $value/10000\n"; }

preferences:
32.51 ms | 402 KiB | 5 Q