title: How to implement the Gaussian mutation operator for a genetic algorithm in Java
body: <p>I try to learn and implement a simple genetic algorithm library for my project. At this time, evolution, selection of population is ready, and I'm trying to implement a simple good mutation operator like the <a href="http://www.iue.tuwien.ac.at/phd/heitzinger/node27.html" rel="nofollow noreferrer">Gaussian mutation operator</a> (GMO) for my genetic evolution engine in Java and Scala.</p>
  
  <p>I find some information on Gaussian mutation operator (GMO) into the paper <em><a href="http://dl.dropbox.com/u/3026820/fulltext.pdf" rel="nofollow noreferrer">A mutation operator based on a Pareto ranking for multi-objective evolutionary algorithms</a></em> (P.M. Mateo, I. Alberto), page 6 and 7.</p>
  
  <p>But I have some problem to find other information on how to implement this Gaussian mutation operator and other useful variants of this operator in Java. What should I do?</p>
  
  <p>I'm using the <code>random.nextGaussian()</code> function of random Java util, but this method only returns a random number between 0 and 1.</p>
  
  <p>So, </p>
  
  <p>a) How can I modify the precision of the return number in this case? (For example, I want to get a random double number between 0 and 1 with step equal to 0.00001.)</p>
  
  <p>b) and how can I specify <code>mu</code> and <code>sigma</code> for this function, because I want to search locally about a value of my genome, not between -1 and 1. How can I ajust that local research around my genome value?</p>
  
  <p>After research, I found an answer for the b) question. It seems I can displace the Gaussian random number like this:</p>
  
  <pre><code> newGenomeValue = oldGenomeValue + (( gaussiandRndNumber * sigma ) + mean )
  </code></pre>
  
  <p>where <code>mean</code> = my genome value.</p>
  
  <p>(Cf. method of bottom page in <a href="http://c-faq.com/lib/gaussian.html" rel="nofollow noreferrer">How can I generate random numbers with a normal or Gaussian distribution?</a>.)</p>