From 53a5d21db29dcd910e5b256255ef6ed776497c0d Mon Sep 17 00:00:00 2001 From: Colin Patrick McCabe Date: Thu, 3 Mar 2011 14:46:12 -0800 Subject: [PATCH] pickrand.py: fix off-by-one Signed-off-by: Colin McCabe --- pickrand.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/pickrand.py b/pickrand.py index 8253e74..9efec59 100755 --- a/pickrand.py +++ b/pickrand.py @@ -12,6 +12,6 @@ for root, dirs, files in os.walk(".", followlinks=True): if (len(allfiles) == 0): sys.exit(1) random.seed(None) -r = random.randint(0,len(allfiles)) +r = random.randint(0,len(allfiles) - 1) print(allfiles[r]) sys.exit(0) -- 1.6.6.rc1.39.g9a42