code: def test_rand_intervals_rand_n(random_state):
      """Test random intervals."""
      n_timepoints = 30
      x = np.arange(n_timepoints)
  
      intervals = _rand_intervals_rand_n(x)
      assert intervals.ndim == 2
      assert np.issubdtype(intervals.dtype, np.integer)
      # assert intervals.shape[0] == np.unique(intervals, axis=0).shape[0]  #
      # no duplicates
  
      starts = intervals[:, 0]
      ends = intervals[:, 1]
      assert np.all(ends <= x.size)  # within bounds
      assert np.all(starts >= 0)  # within bounds
      assert np.all(ends > starts)
  
file_path: sktime/sktime/transformations/panel/tests/test_segment.py
imports: import numpy
  import pandas
  import pytest
  from sktime.transformations.panel.segment import RandomIntervalSegmenter, _rand_intervals_fixed_n, _rand_intervals_rand_n
  from sktime.utils._testing.panel import _make_nested_from_array
label_desc: Use image node_id 4 for calling a global function with example usage: test_rand_intervals_rand_n(random_state) without return types