code: def sample(probs):
      s = sum(probs)
      probs = [a / s for a in probs]
      r = random.uniform(0, 1)
      for i in range(len(probs)):
          r = r - probs[i]
          if r <= 0:
              return i
      return len(probs) - 1
  
file_path: MMdnn/mmdnn/conversion/examples/darknet/darknet.py
imports: from ctypes import *
  import math
  import random
label_desc: Use image node_id 1 for calling a global function with example usage: sample(probs) and returns: unknown, i