code: def _get_intervals(
      n_intervals: int,
      min_interval: int,
      series_length: int,
      rng: RandomState,
      inner_series_length: Optional[int] = None,
  ) -> np.ndarray:
      """Generate random intervals for given parameters.
  
      Parameters
      ----------
      n_intervals : int
          Number of intervals to generate.
      min_interval : int
          Minimum length of an interval.
      series_length : int
          Length of the series.
      rng : RandomState
          Random number generator.
      inner_series_length : int, optional (default=None)
          Length of the inner series, define the maximum of an interval
          and forces intervals to be contained in disjoint segments of
          length inner_series_length. If None, defaults to series_length.
  
      Returns
      -------
      intervals_starts_and_end_matrix : np.ndarray
          Matrix of shape (n_intervals, 2) where each row represents an
          interval and contains its start and end.
      """
      interval_max_length = (
          series_length
          if inner_series_length is None
          else inner_series_length
      )
      capped_min_interval = (
          interval_max_length
          if min_interval >= interval_max_length
          else min_interval
      )
      number_of_inner_intervals = series_length // interval_max_length
      intervals_starts_and_end_matrix = np.zeros(
          (n_intervals, 2), dtype=int
      )
      for interval_index in range(n_intervals):
          inner_intervals_step = rng.randint(number_of_inner_intervals)
          current_interval_start = (
              inner_intervals_step * interval_max_length
              + rng.randint(
                  max(1, interval_max_length - capped_min_interval)
              )
          )
          current_interval_length = compute_interval_length(
              capped_min_interval,
              current_interval_start,
              inner_intervals_step,
              interval_max_length,
              rng,
          )
          current_interval_end = (
              current_interval_start + current_interval_length
          )
          intervals_starts_and_end_matrix[interval_index, :] = [
              current_interval_start,
              current_interval_end,
          ]
      return intervals_starts_and_end_matrix
  
file_path: sktime/sktime/series_as_features/base/estimators/interval_based/_tsf.py
imports: import math
  from typing import Optional
  import numpy
  from joblib import Parallel, delayed
  from numpy.random import RandomState
  from sklearn.utils.multiclass import class_distribution
  from sklearn.utils.validation import check_random_state
  from sktime.base._base import _clone_estimator
  from sktime.utils.slope_and_trend import _slope
  from sktime.utils.validation import check_n_jobs
label_desc: Use image node_id 1 for calling a global function with example usage: _get_intervals(n_intervals, min_interval, series_length, rng, inner_series_length) and returns: intervals_starts_and_end_matrix