fork(2) download
  1. <?php
  2.  
  3.  
  4. function randarr( $N, $min = 0, $max = 100) {
  5. return array_map(
  6. function() use($min, $max) {
  7. return rand( $min, $max);
  8. },
  9. array_pad( [], $N, 0)
  10. );
  11. }
  12.  
  13. print_r( randarr(5));
  14. print_r( randarr(5, 22, 24));
  15. print_r( randarr(5, 0, 1E9));
  16.  
Success #stdin #stdout 0.02s 52480KB
stdin
Standard input is empty
stdout
Array
(
    [0] => 93
    [1] => 83
    [2] => 76
    [3] => 12
    [4] => 88
)
Array
(
    [0] => 24
    [1] => 23
    [2] => 22
    [3] => 22
    [4] => 24
)
Array
(
    [0] => 289735940
    [1] => 435158592
    [2] => 650113843
    [3] => 744380869
    [4] => 830975526
)