As part of a real coded genetic algorithm, I have to generate a random number beta that follows Laplace Distribution.
The give relationship is 
beta(i)
= ab*log(u(i)) [if r(i) <= 0.5]
= a+b*log(u(i)) [if r(i) > 0.5]
Where i varies from 1 to n (n is the length of the chromosome). r(i) and u(i) are uniform random numbers belonging to the interval [0,1]. a and b are constants.
I want to make a list of beta values for each i and hence wrote the following lines of code:

bet = []

for i in range(chromlen):

if (random.uniform(0,1) <= 0.5):

bet.append((ab*(math.log(random.uniform(0,1)+0.000000000001)))

else:

bet.append((a+b*(math.log(random.uniform(0,1)+0.000000000001)))

beta = bet

This way I have a list of beta values that have been generated randomly and follow Laplace Distribution
I'm receiving a message when I run the program that says "There's an error in your program: invalid syntax" and it highlights 'else' in red.
I can't figure out where I made a mistake. Please help. Thanks.
I've imported 'random' and 'math' earlier in the code. As I mentioned before, this is just part of the code.