code: def test_select_random_subset():
      num_total_samples = 10
      for num_samples_to_select in range(num_total_samples):
          if num_samples_to_select > 0:
              indices1 = common.select_random_subset(
                  random_seed=0,
                  num_total_samples=num_total_samples,
                  num_samples_to_select=num_samples_to_select,
              )
              assert len(indices1) == num_samples_to_select
  
              indices2 = common.select_random_subset(
                  random_seed=1,
                  num_total_samples=num_total_samples,
                  num_samples_to_select=num_samples_to_select,
              )
              assert len(indices2) == num_samples_to_select
  
              assert indices1 != indices2
          else:
              with pytest.raises(ValueError):
                  common.select_random_subset(
                      random_seed=0,
                      num_total_samples=num_total_samples,
                      num_samples_to_select=num_samples_to_select,
                  )
  
      for percentage_of_samples in [0, 20, 40, 60, 80, 100, 120]:
          if 0 < percentage_of_samples <= 100:
              indices1 = common.select_random_subset(
                  random_seed=0,
                  num_total_samples=num_total_samples,
                  percentage_of_samples_to_select=percentage_of_samples,
              )
              assert (
                  len(indices1)
                  == percentage_of_samples * num_total_samples / 100
              )
  
              indices2 = common.select_random_subset(
                  random_seed=1,
                  num_total_samples=num_total_samples,
                  percentage_of_samples_to_select=percentage_of_samples,
              )
              assert (
                  len(indices2)
                  == percentage_of_samples * num_total_samples / 100
              )
  
              assert indices1 != indices2
          else:
              with pytest.raises(ValueError):
                  common.select_random_subset(
                      random_seed=0,
                      num_total_samples=num_total_samples,
                      percentage_of_samples_to_select=percentage_of_samples,
                  )
  
file_path: ml-cvnets/tests/data/datasets/utils/test_common.py
imports: import numpy
  import pytest
  from data.datasets.utils import common
label_desc: Use image node_id 7 for calling a global function with example usage: test_select_random_subset() without return types