code: def test_gridsearch_n_random_samples(self):
      np.random.seed(1)
  
      params = {
          "lags": list(range(1, 11)),
          "past_covariates": list(range(1, 11)),
      }
  
      params_cross_product = list(product(*params.values()))
  
      # Test absolute sample
      absolute_sampled_result = RandomForest._sample_params(
          params_cross_product, 10
      )
      assert len(absolute_sampled_result) == 10
  
      # Test percentage sample
      percentage_sampled_result = RandomForest._sample_params(
          params_cross_product, 0.37
      )
      assert len(percentage_sampled_result) == 37
  
imports: import random
  from itertools import product
  import numpy
  import pandas
  import pytest
  from darts import TimeSeries
  from darts.datasets import AirPassengersDataset, MonthlyMilkDataset
  from darts.logging import get_logger
  from darts.metrics import mape, r2_score
  from darts.models import ARIMA, FFT, ExponentialSmoothing, NaiveDrift, NaiveSeasonal, Theta
  from darts.tests.conftest import tfm_kwargs
  from darts.utils.timeseries_generation import gaussian_timeseries
  from darts.utils.timeseries_generation import linear_timeseries
  from darts.utils.timeseries_generation import random_walk_timeseries
  from darts.utils.timeseries_generation import sine_timeseries
label_desc: Use image node_id 9 for calling the TestBacktesting obj's underlying member method code with example usage: obj.test_gridsearch_n_random_samples() without return types