code: def test_split_dataset_random(self):
      x = torch.rand(32, 10)
      y = torch.arange(
          32
      )  # we use ordered labels to reconstruct the order after shuffling
      dd = AvalancheDataset([TensorDataset(x, y)])
  
      d1, d2 = split_validation_random(
          validation_size=0.5, shuffle=True, dataset=dd
      )
      assert len(d1) + len(d2) == len(dd)
  
      # check data is shuffled
      iis = []
      for x, ii in d1:
          iis.append(ii)
      for x, ii in d2:
          iis.append(ii)
      assert not all(b >= a for a, b in zip(iis[:-1], iis[1:]))
  
      # check d1
      for x, ii in d1:
          torch.testing.assert_close(x, dd[ii.item()][0])
          torch.testing.assert_close(ii, dd[ii.item()][1])
      # check d2
      for x, ii in d2:
          torch.testing.assert_close(x, dd[ii.item()][0])
          torch.testing.assert_close(ii, dd[ii.item()][1])
  
imports: import unittest
  import torch
  from numpy.testing import assert_almost_equal
  from torch.utils.data import TensorDataset, DataLoader
  from avalanche.benchmarks import benchmark_from_datasets, benchmark_with_validation_stream, CLScenario, CLStream, split_validation_random, task_incremental_benchmark
  from avalanche.benchmarks.scenarios.dataset_scenario import DatasetExperience, split_validation_class_balanced
  from avalanche.benchmarks.utils import AvalancheDataset
  from tests.unit_tests_utils import dummy_tensor_dataset, get_fast_benchmark, DummyImageDataset
label_desc: Use image node_id 1 for calling the DatasetSplitterTest obj's underlying member method code with example usage: obj.test_split_dataset_random() without return types