original_docstring: 
      Generate a new scattering angle using a cdf.
  
      A uniformly spaced cumulative distribution function (CDF) is needed.
      New random angles are generated by selecting a random interval
      mu[i] to mu[i+1] and choosing an angle uniformly distributed over
      the interval.
  
      Args:
         mu_cdf: a cumulative distribution function
  
      Returns
         The cosine of the scattering angle
      
docstring: Generate a new scattering angle using a cdf.
  A uniformly spaced cumulative distribution function (CDF) is needed.
  New random angles are generated by selecting a random interval
  mu[i] to mu[i+1] and choosing an angle uniformly distributed over
  the interval.
docstring_tokens: Generate a new scattering angle using a cdf . A uniformly spaced cumulative distribution function ( CDF ) is needed . New random angles are generated by selecting a random interval mu [ i ] to mu [ i + 1 ] and choosing an angle uniformly distributed over the interval .
code: def generate_mie_costheta(mu_cdf):
      """
      Generate a new scattering angle using a cdf.
  
      A uniformly spaced cumulative distribution function (CDF) is needed.
      New random angles are generated by selecting a random interval
      mu[i] to mu[i+1] and choosing an angle uniformly distributed over
      the interval.
  
      Args:
         mu_cdf: a cumulative distribution function
  
      Returns
         The cosine of the scattering angle
      """
      # the following should be equivalent to these four lines
      # index = np.random.randint(0, high=len(mu_cdf))
      num = len(mu_cdf) - 1
      index = int(np.random.random() * num)
      if index >= num:
          index = num - 1
  
      x = mu_cdf[index]
      x += (mu_cdf[index + 1] - mu_cdf[index]) * np.random.random()
  
      return x
code_tokens: def generate_mie_costheta ( mu_cdf ) : num = len ( mu_cdf ) - 1 index = int ( np . random . random ( ) * num ) if index >= num : index = num - 1 x = mu_cdf [ index ] x += ( mu_cdf [ index + 1 ] - mu_cdf [ index ] ) * np . random . random ( ) return x
short_docstring: Generate a new scattering angle using a cdf.
short_docstring_tokens: Generate a new scattering angle using a cdf .
comment: """
      Generate a new scattering angle using a cdf.
  
      A uniformly spaced cumulative distribution function (CDF) is needed.
      New random angles are generated by selecting a random interval
      mu[i] to mu[i+1] and choosing an angle uniformly distributed over
      the interval.
  
      Args:
         mu_cdf: a cumulative distribution function
  
      Returns
         The cosine of the scattering angle
      """$SEP$# the following should be equivalent to these four lines$SEP$# index = np.random.randint(0, high=len(mu_cdf))