1.1 --- a/optimiser.py Thu Oct 08 10:42:30 2015 +0200
1.2 +++ b/optimiser.py Thu Oct 08 23:37:29 2015 +0200
1.3 @@ -20,7 +20,7 @@
1.4 with this program. If not, see <http://www.gnu.org/licenses/>.
1.5 """
1.6
1.7 -from random import random
1.8 +from random import random, randrange
1.9 from os.path import split, splitext
1.10 import EXIF
1.11 import PIL.Image
1.12 @@ -170,6 +170,9 @@
1.13
1.14 l = pattern(rgb, chosen)
1.15 limit = sum([f for f, c in l])
1.16 + if not limit:
1.17 + return l[randrange(0, len(l))][1]
1.18 +
1.19 choose = random() * limit
1.20 threshold = 0
1.21 for f, c in l: