code: def dataset_uniform_x(
      x: np.ndarray, n_samples: Optional[int] = None
  ) -> np.ndarray:
      """Helper function to pick random test samples."""
      if not isinstance(x, np.ndarray) or x.ndim != 2:
          msg = "Two dimensional numpy array is required."
          raise AssertionError(msg)
      if not n_samples:
          n_samples = PORTER_N_UNI_REGRESSION_TESTS
      n_samples = min(n_samples, len(x))
      return x[
          (np.random.uniform(0, 1, n_samples) * (len(x) - 1)).astype(
              int
          )
      ]
  
file_path: sklearn-porter/tests/utils/__init__.py
imports: from os import environ, sep
  from pathlib import Path
  from typing import List, Optional, Tuple
  import numpy
  from tests.commons import PORTER_N_UNI_REGRESSION_TESTS, PORTER_N_GEN_REGRESSION_TESTS
label_desc: Use image node_id 3 for calling a global function with example usage: dataset_uniform_x(x, n_samples) and returns: x