Alan Gauld wrote:

> rand_num = None
> 
> def rand_int():
>     global rand_num
>     if not rand_num:

This will not recognize the (unlikely but possible) case that 
random.random() returns 0.0. So you better check for None explicitly

      if rand_num is None:
>        rand_num = int(math.ceil (random.random()*1000))
>     return rand_num


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to