parameters: (n, b)
docstring: Returns the  random choice sample of size n
      having the choice between len(b) options where each option has
      the probability represented in vector b.
docstring_summary: Returns the  random choice sample of size n
      having the choice between len(b) options where each option has
      the probability represented in vector b.
docstring_tokens: Returns the random choice sample of size n having the choice between len ( b ) options where each option has the probability represented in vector b .
function: def random_choice(n, b):
      """
      Returns the  random choice sample of size n
      having the choice between len(b) options where each option has
      the probability represented in vector b.
      """
      # print 'misc.random_choice'
      if np.__version__ >= '1.7.0':
          # print '  b',b.size,b,b.flat
          # print '  n',n
          return np.clip(np.random.choice(b.size, n, p=b.flat), 0, len(b)-1)
      else:
          return np.clip(np.searchsorted(np.cumsum(b), np.random.random(n)), 0, len(b)-1)
function_tokens: def random_choice ( n , b ) : # print 'misc.random_choice' if np . __version__ >= '1.7.0' : # print '  b',b.size,b,b.flat # print '  n',n return np . clip ( np . random . choice ( b . size , n , p = b . flat ) , 0 , len ( b ) - 1 ) else : return np . clip ( np . searchsorted ( np . cumsum ( b ) , np . random . random ( n ) ) , 0 , len ( b ) - 1 )