Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function microtime_float()
- {
- list($usec, $sec) = explode(" ", microtime());
- return ((float)$usec + (float)$sec);
- }
- /**
- * 30 Mil números aleatórios de 1 a 50 mil sem repetição
- */
- $time_start = microtime_float();
- function randomGen($min, $max, $quantity) {
- $numbers = range($min, $max);
- shuffle($numbers);
- return array_unique($numbers);
- }
- $arr = randomGen(0,50000,30000);
- $val = "";
- foreach ($arr as $key => $value) {
- $val .= $value.'<br>';
- }
- echo $val;
- $time_end = microtime_float();
- $time = round($time_end - $time_start, 5);
- echo "<br><br>Tempo de execucao: $time segundos\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement