class_docstr: @brief Genetic algorithm math API.
docstr: !
  @brief Returns index in probabilities.
  
  @param[in] probabilities (list): List with segments in increasing sequence with val in [0, 1],
             for example, [0 0.1 0.2 0.3 1.0].
code: def get_uniform(probabilities):
      """!
      @brief Returns index in probabilities.
  
      @param[in] probabilities (list): List with segments in increasing sequence with val in [0, 1],
                 for example, [0 0.1 0.2 0.3 1.0].
      """
  
      # Initialize return value
      res_idx = None
  
      # Get random num in range [0, 1)
      random_num = np.random.rand()
  
      # Find segment with  val1 < random_num < val2
      for _idx in range(len(probabilities)):
          if random_num < probabilities[_idx]:
              res_idx = _idx
              break
  
      return res_idx
  
file_path: pyclustering/pyclustering/cluster/ga_maths.py
imports: import numpy
label_desc: Use image node_id 7 for calling the ga_math obj's underlying member method code with example usage: obj.get_uniform(probabilities) and returns: res_idx