code: def random_sample(obj, bounds, max_evals, vectorised=True):
      """Optimises a function by randomly sampling and choosing its maximum."""
      dim = len(bounds)
      rand_pts = map_to_bounds(
          np.random.random((int(max_evals), dim)), bounds
      )
      if vectorised:
          obj_vals = obj(rand_pts)
      else:
          obj_vals = np.array([obj(x) for x in rand_pts])
      return rand_pts, obj_vals
  
imports: from __future__ import print_function
  from __future__ import division
  from argparse import Namespace
  from datetime import datetime
  from warnings import warn
  import os
  import numpy
  from .general_utils import map_to_bounds
  from .doo import DOOFunction, pdoo_wrap
label_desc: Use image node_id 2 for calling a global function with example usage: random_sample(obj, bounds, max_evals, vectorised) and returns: rand_pts,  obj_vals