code: def test_random_sample():
      pbounds = {
          "p1": (0, 1),
          "p3": (0, 3),
          "p2": (0, 2),
          "p4": (0, 4),
      }
      space = TargetSpace(target_func, pbounds, random_state=8)
  
      for _ in range(50):
          random_sample = space.random_sample()
          assert len(random_sample) == space.dim
          assert all(random_sample >= space.bounds[:, 0])
          assert all(random_sample <= space.bounds[:, 1])
  
imports: import pytest
  import numpy
  from bayes_opt.constraint import ConstraintModel
  from bayes_opt.target_space import TargetSpace
  from bayes_opt.util import NotUniqueError
label_desc: Use image node_id 10 for calling a global function with example usage: test_random_sample() without return types