code: def _rand_bboxes(num_boxes, h, w):
      cx, cy, bw, bh = torch.rand(num_boxes, 4).T
  
      tl_x = ((cx * w) - (w * bw / 2)).clamp(0, w).unsqueeze(0)
      tl_y = ((cy * h) - (h * bh / 2)).clamp(0, h).unsqueeze(0)
      br_x = ((cx * w) + (w * bw / 2)).clamp(0, w).unsqueeze(0)
      br_y = ((cy * h) + (h * bh / 2)).clamp(0, h).unsqueeze(0)
  
      bboxes = torch.cat([tl_x, tl_y, br_x, br_y], dim=0).T
  
      return bboxes
  
file_path: mmocr/tests/test_visualization/test_kie_visualizer.py
imports: import os.path
  import tempfile
  import unittest
  import cv2
  import numpy
  import torch
  from mmengine.structures import InstanceData
  from mmocr.structures import KIEDataSample
  from mmocr.utils import bbox2poly
  from mmocr.visualization import KIELocalVisualizer
label_desc: Use image node_id 2 for calling the TestTextKIELocalVisualizer obj's underlying member method code with example usage: obj._rand_bboxes(num_boxes, h, w) and returns: bboxes