code: def rand_prob_dist(
      self, batch_num: int, n_classes: int
  ) -> torch.Tensor:
      assert n_classes > 1
      result = torch.zeros((batch_num, n_classes))
      result[:, 0] = torch.rand((batch_num,))
      diff = 1 - result[:, 0]
      for i in range(1, n_classes - 1):
          result[:, i] = diff * torch.rand((batch_num,))
          diff -= result[:, i]
      result[:, -1] = diff
      return result
  
file_path: mmocr/tests/test_models/test_kie/test_postprocessors/test_sdmgr_postprocessor.py
imports: import copy
  from unittest import TestCase
  import torch
  from mmengine.structures import InstanceData
  from mmocr.models.kie.postprocessors import SDMGRPostProcessor
  from mmocr.structures import KIEDataSample
label_desc: Use image node_id 2 for calling the TestSDMGRPostProcessor obj's underlying member method code with example usage: obj.rand_prob_dist(batch_num, n_classes) and returns: result