code: def random_split(
      dataset: AnomalibDataset,
      split_ratio: float | Sequence[float],
      label_aware: bool = False,
      seed: int | None = None,
  ) -> list[AnomalibDataset]:
      """Perform a random split of a dataset.
  
      Args:
          dataset (AnomalibDataset): Source dataset
          split_ratio (Union[float, Sequence[float]]): Fractions of the splits that will be produced. The values in the
              sequence must sum to 1. If a single value is passed, the ratio will be converted to
              [1-split_ratio, split_ratio].
          label_aware (bool): When True, the relative occurrence of the different class labels of the source dataset will
              be maintained in each of the subsets.
          seed (int | None, optional): Seed that can be passed if results need to be reproducible
      """
  
      if isinstance(split_ratio, float):
          split_ratio = [1 - split_ratio, split_ratio]
  
      assert (
          math.isclose(sum(split_ratio), 1) and sum(split_ratio) <= 1
      ), f"split ratios must sum to 1, found {sum(split_ratio)}"
      assert all(
          0 < ratio < 1 for ratio in split_ratio
      ), f"all split ratios must be between 0 and 1, found {split_ratio}"
  
      # create list of source data
      if label_aware and "label_index" in dataset.samples.keys():
          indices_per_label = [
              group.index
              for _, group in dataset.samples.groupby("label_index")
          ]
          per_label_datasets = [
              dataset.subsample(indices)
              for indices in indices_per_label
          ]
      else:
          per_label_datasets = [dataset]
  
      # outer list: per-label unique, inner list: random subsets with the given ratio
      subsets: list[list[AnomalibDataset]] = []
      # split each (label-aware) subset of source data
      for label_dataset in per_label_datasets:
          # get subset lengths
          subset_lengths = [
              math.floor(len(label_dataset.samples) * ratio)
              for ratio in split_ratio
          ]
          for i in range(
              len(label_dataset.samples) - sum(subset_lengths)
          ):
              subset_idx = i % sum(subset_lengths)
              subset_lengths[subset_idx] += 1
          if 0 in subset_lengths:
              warnings.warn(
                  "Zero subset length encountered during splitting. This means one of your subsets might be"
                  " empty or devoid of either normal or anomalous images."
              )
  
          # perform random subsampling
          random_state = (
              torch.Generator().manual_seed(seed) if seed else None
          )
          indices = torch.randperm(
              len(label_dataset.samples), generator=random_state
          )
          subsets.append(
              [
                  label_dataset.subsample(subset_indices)
                  for subset_indices in torch.split(
                      indices, subset_lengths
                  )
              ]
          )
  
      # invert outer/inner lists
      # outer list: subsets with the given ratio, inner list: per-label unique
      subsets = list(map(list, zip(*subsets)))
      return [concatenate_datasets(subset) for subset in subsets]
  
file_path: anomalib/src/anomalib/data/utils/split.py
imports: from __future__ import annotations
  import math
  import warnings
  from enum import Enum
  from typing import TYPE_CHECKING, Sequence
  import torch
label_desc: Use image node_id 2 for calling a global function with example usage: random_split(dataset, split_ratio, label_aware, seed) and returns: unknown