code: def test_random(named_model_space, engine, dedup):
      name, model_space = named_model_space
      strategy = Random(dedup=dedup)
      assert repr(strategy) == f"Random(dedup={dedup})"
      strategy(model_space, engine)
      if dedup:
          if name != "numerical":
              assert len(list(engine.list_models())) == len(
                  list(model_space.grid())
              )
          assert next(strategy.list_models()).metric == 1.0
  
      state_dict = strategy.state_dict()
      previous_submitted = len(list(engine.list_models()))
      strategy2 = Random(dedup=dedup)
      strategy2.load_state_dict(state_dict)
  
      engine.max_model_count += 10
      strategy2(model_space, engine)
      if dedup:
          assert len(list(engine.list_models())) == previous_submitted
      else:
          assert (
              len(list(engine.list_models())) == engine.max_model_count
          )
  
imports: from __future__ import annotations
  import pytest
  import nni
  from nni.mutable import *
  from nni.nas.evaluator import FunctionalEvaluator
  from nni.nas.execution import SequentialExecutionEngine
  from nni.nas.space import *
  from nni.nas.strategy import GridSearch, Random, RegularizedEvolution, PolicyBasedRL
  import torch
  from torch import nn
  from tianshou.policy import A2CPolicy
  from tianshou.data import to_torch
label_desc: Use image node_id 5 for calling a global function with example usage: test_random(named_model_space, engine, dedup) without return types