original_string: public static function random(array $array, int $amount = null)
      {
          if (is_null($amount)) {
              return $array[array_rand($array)];
          }
  
          $keys = array_rand($array, $amount);
  
          $results = [];
  
          foreach ((array) $keys as $key) {
              $results[] = $array[$key];
          }
  
          return $results;
      }
code: public static function random(array $array, int $amount = null)
      {
          if (is_null($amount)) {
              return $array[array_rand($array)];
          }
  
          $keys = array_rand($array, $amount);
  
          $results = [];
  
          foreach ((array) $keys as $key) {
              $results[] = $array[$key];
          }
  
          return $results;
      }
code_tokens: public static function random ( array $ array , int $ amount = null ) { if ( is_null ( $ amount ) ) { return $ array [ array_rand ( $ array ) ] ; } $ keys = array_rand ( $ array , $ amount ) ; $ results = [ ] ; foreach ( ( array ) $ keys as $ key ) { $ results [ ] = $ array [ $ key ] ; } return $ results ; }
docstring: Get a 1 value from an array.
  
  @param array    $array
  @param int|null $amount
  
  @return mixed
  
  @throws \InvalidArgumentException
docstring_tokens: Get a 1 value from an array .