def choice_helper(random_state, a, replace, p, size):
 if (a.ndim > 1):
  raise ValueError(('a.ndim (%i) must be 0 or 1' % a.ndim))
 if (p.ndim == 1):
  if (p.size == 0):
   p = None
 else:
  raise ValueError(('p.ndim (%i) must be 1' % p.ndim))
 replace = bool(replace)
 return random_state.choice(a, size, replace, p)

def choice_helper ( random_state , a , replace , p , size ) : if ( a . ndim > 1 ) : raise ValueError ( ( 'a.ndim (%i) must be 0 or 1' % a . ndim ) ) if ( p . ndim == 1 ) : if ( p . size == 0 ) : p = None else : raise ValueError ( ( 'p.ndim (%i) must be 1' % p . ndim ) ) replace = bool ( replace ) return random_state . choice ( a , size , replace , p )
helper function to draw random numbers using numpys choice function .