projects
/
cmccabe-bin
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
656c0ba
)
pickrand.py: fix off-by-one
author
Colin Patrick McCabe
<cmccabe@alumni.cmu.edu>
Thu, 3 Mar 2011 22:46:12 +0000 (14:46 -0800)
committer
Colin Patrick McCabe
<cmccabe@alumni.cmu.edu>
Thu, 3 Mar 2011 22:46:12 +0000 (14:46 -0800)
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
pickrand.py
patch
|
blob
|
history
diff --git
a/pickrand.py
b/pickrand.py
index
8253e74
..
9efec59
100755
(executable)
--- 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)