def emitter(p=0.03):
 while True:
  v = np.random.rand(1)
  if (v > p):
   (yield 0.0)
  else:
   (yield np.random.rand(1))

def emitter ( p = 0.03 ) : while True : v = np . random . rand ( 1 ) if ( v > p ) : ( yield 0.0 ) else : ( yield np . random . rand ( 1 ) )
return a random value with probability p .