Q:

How do I mutate a value in a genetic algorithm using Gaussian distribution?

I've been reading 'Introduction to Evolutionary Algorithms'. This method is stated, but not described, and I can't find anything more specific online. p44/45 of 2nd Ed for reference.

adding to the current gene value an amount drawn randomly from a Gaussian distribution with mean zero and user-specified standard deviation

Would be great to get the step by step, from initial to mutated value, including how Gaussian distribution works (or a link to something that could fill that gap).

A:

A gaussian distribution is that favorite curve from math and stats also known as the bell curve or a normal distribution.
An example of this can be seen with the sum of rolling 10x 10 sided dice:

From AnyDice output 10d10
What this means is that the amount of mutation for a gene is most likely very little.  If you roll this set of dice 30 times, you'll get some data that looks like:
53, 38, 52, 62, 51, 50, 71, 44, 52, 55, 56, 45, 48, 67, 48, 63, 33, 40, 62, 60, 54, 48, 67, 60, 44, 63, 50, 50, 64, 56
Notice that most of these numbers are fairly close to the value of 55.  Thats the key to this - you want a middle value.
When doing a mutation on a gene that has a possible change of -10 .. +10 you want most of the chance to be about 0.  Maybe some 1s, or 2s, or -1s, or -2s... but you don't want a +10 to have an equal chance of a mutation as a +1.
So? How do you do this?
In Java, one would use java.util.Random#nextGaussian().  That will give you a number that has a normal distribution with a mean of 0.0.
You would take the value you get from nextGaussian(), and then... well, do math to it to get it into the range you want.  Just because you're getting a number with a mean of 0.0 doesn't mean that any given value will be in a certain range.
The specifics of the nextGaussian() for your chosen language is just a matter of finding the right library for the language.  Its there somewhere.  You may wish to browse the tag: normal-distribution on Stack Overflow filtered for your language to see if any of those questions specifically help you.

