code: def test_equalize_randomized(ray_start_regular_shared):
      # verify the entries in the splits are in the range of 0 .. num_rows,
      # unique, and the total number matches num_rows if exact_num == True.
      def assert_unique_and_inrange(splits, num_rows, exact_num=False):
          unique_set = set()
          for split in splits:
              for block in split:
                  for entry in block:
                      assert entry not in unique_set
                      assert entry >= 0 and entry < num_rows
                      unique_set.add(entry)
          if exact_num:
              assert len(unique_set) == num_rows
  
      # verify that splits are equalized.
      def assert_equal_split(splits, num_rows, num_split):
          split_size = num_rows // num_split
          for split in splits:
              assert (
                  len((list(itertools.chain.from_iterable(split))))
                  == split_size
              )
  
      # create randomized splits contains entries from 0 ... num_rows.
      def random_split(num_rows, num_split):
          split_point = [
              int(random.random() * num_rows)
              for _ in range(num_split - 1)
          ]
          split_index_helper = [0] + sorted(split_point) + [num_rows]
          splits = []
          for i in range(1, len(split_index_helper)):
              split_start = split_index_helper[i - 1]
              split_end = split_index_helper[i]
              num_entries = split_end - split_start
              split = []
              num_block_split = int(random.random() * num_entries)
              block_split_point = [
                  split_start + int(random.random() * num_entries)
                  for _ in range(num_block_split)
              ]
              block_index_helper = (
                  [split_start]
                  + sorted(block_split_point)
                  + [split_end]
              )
              for j in range(1, len(block_index_helper)):
                  split.append(
                      list(
                          range(
                              block_index_helper[j - 1],
                              block_index_helper[j],
                          )
                      )
                  )
              splits.append(split)
          assert_unique_and_inrange(splits, num_rows, exact_num=True)
          return splits
  
      for i in range(100):
          num_rows = int(random.random() * 100)
          num_split = int(random.random() * 10) + 1
          input_splits = random_split(num_rows, num_split)
          print(input_splits)
          equalized_splits = equalize_helper(input_splits)
          assert_unique_and_inrange(equalized_splits, num_rows)
          assert_equal_split(equalized_splits, num_rows, num_split)
  
imports: import itertools
  import math
  import random
  import time
  from unittest.mock import patch
  import numpy
  import pandas
  import pytest
  import ray
  from ray.data._internal.block_list import BlockList
  from ray.data._internal.equalize import _equalize
  from ray.data._internal.execution.interfaces import RefBundle
  from ray.data._internal.logical.interfaces import LogicalPlan
  from ray.data._internal.logical.operators.input_data_operator import InputData
  from ray.data._internal.plan import ExecutionPlan
  from ray.data._internal.split import _drop_empty_block_split, _generate_global_split_results, _generate_per_block_split_indices, _generate_valid_indices, _split_at_indices, _split_single_block
  from ray.data._internal.stats import DatasetStats
  from ray.data.block import BlockAccessor, BlockMetadata
  from ray.data.dataset import Dataset
  from ray.data.tests.conftest import *
  from ray.data.tests.util import extract_values
  from ray.tests.conftest import *
label_desc: Use image node_id 26 for calling a global function with example usage: test_equalize_randomized(ray_start_regular_shared) and returns: splits