code: def _random_center_initializer(
      X: np.ndarray,
      n_clusters: int,
      random_state: np.random.RandomState,
      **kwargs,
  ) -> np.ndarray:
      """Compute initial centroids using random method.
  
      This works by assigning each point randomly to a cluster. Then the average of
      the cluster is taken to get the centers.
  
      Parameters
      ----------
      X : np.ndarray (3d array of shape (n_instances,n_dimensions,series_length))
          Time series instances to cluster.
      n_clusters: int, defaults = 8
          The number of clusters to form as well as the number of
          centroids to generate.
      random_state: np.random.RandomState
          Determines random number generation for centroid initialization.
  
      Returns
      -------
      np.ndarray (3d array of shape (n_clusters, n_dimensions, series_length))
          Indexes of the cluster centers.
      """
      new_centres = np.zeros((n_clusters, X.shape[1], X.shape[2]))
      selected = random_state.choice(
          n_clusters, X.shape[0], replace=True
      )
      for i in range(n_clusters):
          curr_indexes = np.where(selected == i)[0]
          result = mean_average(X[curr_indexes])
          if result.shape[0] > 0:
              new_centres[i, :] = result
  
      return new_centres
  
imports: from abc import ABC, abstractmethod
  from typing import Callable, Tuple, Union
  import numpy
  from numpy.random import RandomState
  from sklearn.utils import check_random_state
  from sklearn.utils.extmath import stable_cumsum
  from sktime.clustering.base import BaseClusterer
  from sktime.clustering.metrics.averaging import mean_average
  from sktime.distances import distance_factory, pairwise_distance
  from sktime.distances._ddtw import average_of_slope_transform
label_desc: Use image node_id 2 for calling a global function with example usage: _random_center_initializer(X, n_clusters, random_state) and returns: new_centres