From d2a60c4ae61bef176f7ff92b6ff36c2e33ebf37a Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Mon, 27 Sep 2010 00:26:00 +0000 Subject: round(uniform) to fix problem with missing max values (#2380) --- (limited to 'TurtleArt') diff --git a/TurtleArt/talogo.py b/TurtleArt/talogo.py index 0bcddb1..43886f0 100644 --- a/TurtleArt/talogo.py +++ b/TurtleArt/talogo.py @@ -212,18 +212,18 @@ def tasqrt(x): def tarandom(x, y): """ Random integer """ if numtype(x) and numtype(y): - return(int(uniform(x, y))) + return(int(round(uniform(x, y),0))) xx, xflag = chr_to_ord(x) yy, yflag = chr_to_ord(y) print xx, xflag, yy, yflag if xflag and yflag: - return chr(int(uniform(xx, yy))) + return chr(int(round(uniform(xx, yy),0))) if not xflag: xx = str_to_num(x) if not yflag: yy = str_to_num(y) try: - return(int(uniform(xx, yy))) + return(int(round(uniform(xx, yy),0))) except TypeError: raise logoerror("#notanumber") -- cgit v0.9.1