From 5813fa757fe954c3daecf06358bc9c976aa3c329 Mon Sep 17 00:00:00 2001 From: Sfan5 Date: Wed, 14 Aug 2013 12:59:48 +0200 Subject: [PATCH] [RUtil] Fix bug in !rand caused when a > b --- rutils.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rutils.py b/rutils.py index 9c1be2c..d84e32b 100755 --- a/rutils.py +++ b/rutils.py @@ -262,6 +262,11 @@ def rand(phenny, input): b = int(arg.split(" ")[1]) + 1 except ValueError: return phenny.reply("Could not parse argument 2") + if b < a: + tmp = a + a = b + b = tmp + del tmp phenny.say(str(random.randrange(a, b))) else: try: