code: def random_optimiser_from_func_caller(
      func_caller,
      worker_manager,
      max_capital,
      mode="asy",
      options=None,
      reporter="default",
  ):
      """Creates an appropriate RandomOptimiser Object and optimises the function."""
      reporter = get_reporter(reporter)
      if isinstance(func_caller.domain, domains.EuclideanDomain):
          optimiser_constructor = EuclideanRandomOptimiser
          dflt_list_of_options = euclidean_random_optimiser_args
      elif isinstance(
          func_caller.domain, domains.CartesianProductDomain
      ):
          optimiser_constructor = CPRandomOptimiser
          dflt_list_of_options = cp_random_optimiser_args
      else:
          raise ValueError(
              "Random optimiser not implemented for domain of type %s."
              % (type(func_caller.domain))
          )
      # Load options and modify where necessary
      options = load_options(
          dflt_list_of_options, partial_options=options
      )
      options.mode = mode
      from ..exd.worker_manager import (
          RealWorkerManager,
          SyntheticWorkerManager,
      )
  
      if isinstance(worker_manager, RealWorkerManager):
          options.capital_type = "realtime"
      elif isinstance(worker_manager, SyntheticWorkerManager):
          options.capital_type = "return_value"
      # Create optimiser
      optimiser = optimiser_constructor(
          func_caller, worker_manager, options, reporter
      )
      # optimise and return
      return optimiser.optimise(max_capital)
  
imports: from argparse import Namespace
  import numpy
  from ..exd.cp_domain_utils import get_processed_func_from_raw_func_for_cp_domain, load_cp_domain_from_config_file
  from ..exd import domains
  from ..exd.exd_utils import get_euclidean_initial_qinfos, get_cp_domain_initial_qinfos
  from ..exd.exd_core import mf_exd_args
  from ..exd.experiment_caller import CPFunctionCaller
  from ..exd.cp_domain_utils import sample_from_cp_domain
  from ..exd.worker_manager import SyntheticWorkerManager
  from .blackbox_optimiser import BlackboxOptimiser, blackbox_opt_args, CalledMFOptimiserWithSFCaller
  from ..utils.option_handler import load_options
  from ..utils.reporters import get_reporter
  from ..utils.general_utils import map_to_bounds
label_desc: Use image node_id 2 for calling a global function with example usage: random_optimiser_from_func_caller(func_caller, worker_manager, max_capital, mode, options, reporter) and returns: optimiser