code: def test_random_shuffle_check_random(shutdown_only):
      # Rows from the same input should not be contiguous in the final output.
      num_files = 10
      num_rows = 100
      items = [i for i in range(num_files) for _ in range(num_rows)]
      ds = ray.data.from_items(items, parallelism=num_files)
      out = ds.random_shuffle().take(num_files * num_rows)
      for i in range(num_files):
          part = out[i * num_rows : (i + 1) * num_rows]
          seen = set()
          num_contiguous = 1
          prev = -1
          for x in part:
              x = x["item"]
              if prev != x:
                  prev = x
                  num_contiguous = 1
              else:
                  num_contiguous += 1
                  assert num_contiguous < (
                      num_rows / num_files
                  ), f"{part} contains too many contiguous rows from same input block"
              seen.add(x)
          assert (
              set(range(num_files)) == seen
          ), f"{part} does not contain elements from all input blocks"
  
      # Rows from the same input should appear in a different order in the
      # output.
      num_files = 10
      num_rows = 100
      items = [j for i in range(num_files) for j in range(num_rows)]
      ds = ray.data.from_items(items, parallelism=num_files)
      out = ds.random_shuffle().take(num_files * num_rows)
      for i in range(num_files):
          part = out[i * num_rows : (i + 1) * num_rows]
          num_increasing = 0
          prev = -1
          for x in part:
              x = x["item"]
              if x >= prev:
                  num_increasing += 1
              else:
                  assert num_increasing < (
                      num_rows / num_files
                  ), f"{part} contains non-shuffled rows from input blocks"
                  num_increasing = 0
              prev = x
  
imports: import itertools
  import math
  import random
  import time
  from unittest.mock import patch
  import numpy
  import pandas
  import pyarrow
  import pytest
  import ray
  from ray.data.aggregate import AggregateFn, Count, Max, Mean, Min, Quantile, Std, Sum
  from ray.data.context import DataContext
  from ray.data.tests.conftest import *
  from ray.data.tests.util import column_udf, named_values
  from ray.tests.conftest import *
label_desc: Use image node_id 40 for calling a global function with example usage: test_random_shuffle_check_random(shutdown_only) without return types