code: def random_sampling_kmeans_cts(dim, num_samples):
      """Picks a large number of points uniformly at random and then runs k-means to
      select num_samples points."""
      try:
          from sklearn.cluster import KMeans
  
          num_candidates = np.clip(
              100 * (dim**2), 4 * num_samples, 20 * num_samples
          )
          candidates = random_sampling_cts(dim, num_candidates)
          centres = KMeans(n_clusters=num_samples).fit(candidates)
          return centres.cluster_centers_
      except ImportError:
          return random_sampling_cts(dim, num_samples)
  
imports: from argparse import Namespace
  import numpy
  from .cp_domain_utils import get_processed_from_raw_via_config, get_raw_from_processed_via_config, sample_from_cp_domain
  from ..utils.general_utils import map_to_bounds, flatten_list_of_lists
  from ..utils.oper_utils import direct_ft_maximise, latin_hc_sampling, pdoo_maximise, random_maximise
label_desc: Use image node_id 2 for calling a global function with example usage: random_sampling_kmeans_cts(dim, num_samples) and returns: centres, random_sampling_cts