code: def _rand_intervals_rand_n(x, random_state=None):
      """Sample a random number of intervals.
  
      Compute a random number of intervals from index (x) with
      random starting points and lengths. Intervals are unique, but may
      overlap.
  
      Parameters
      ----------
      x : array_like, shape = (n_timepoints,)
  
      Returns
      -------
      intervals : array-like, shape = (n_intervals, 2)
          2d array containing start and end points of intervals
  
      References
      ----------
      .. [1] Deng, Houtao, et al. "A time series forest for classification
      and feature extraction."
          Information Sciences 239 (2013): 142-153.
      """
      rng = check_random_state(random_state)
      starts = []
      ends = []
      n_timepoints = x.shape[0]  # series length
      W = rng.randint(1, n_timepoints, size=int(np.sqrt(n_timepoints)))
      for w in W:
          size = n_timepoints - w + 1
          start = rng.randint(size, size=int(np.sqrt(size)))
          starts.extend(start)
          for s in start:
              end = s + w
              ends.append(end)
      return np.column_stack([starts, ends])
  
imports: import math
  import numpy
  import pandas
  from sklearn.utils import check_random_state
  from sktime.datatypes._utilities import get_time_index
  from sktime.transformations._delegate import _DelegatedTransformer
  from sktime.transformations.base import BaseTransformer
  from sktime.utils.validation import check_window_length
label_desc: Use image node_id 1 for calling a global function with example usage: _rand_intervals_rand_n(x, random_state) and returns: np