code: def _sampling_from_dist(prob):
      thr = prob.sum() * np.random.rand()
      new_topic = 0
      tmp = prob[new_topic]
      while tmp < thr:
          new_topic += 1
          tmp += prob[new_topic]
      return new_topic
  
file_path: cornac/cornac/models/hft/hft.py
imports: import numpy
  import scipy.optimize
label_desc: Use image node_id 4 for calling the Model obj's underlying member method code with example usage: obj._sampling_from_dist(prob) and returns: new_topic