Index: /trunk/sources/HeuristicLab.Random/3.3/HeuristicLab.Random-3.2.csproj
===================================================================
--- /trunk/sources/HeuristicLab.Random/3.3/HeuristicLab.Random-3.2.csproj	(revision 1687)
+++ /trunk/sources/HeuristicLab.Random/3.3/HeuristicLab.Random-3.2.csproj	(revision 1687)
@@ -0,0 +1,135 @@
+﻿<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>9.0.30729</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{47019A74-F7F7-482E-83AA-D3F4F777E879}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>HeuristicLab.Random</RootNamespace>
+    <AssemblyName>HeuristicLab.Random-3.2</AssemblyName>
+    <SignAssembly>true</SignAssembly>
+    <AssemblyOriginatorKeyFile>HeuristicLab.snk</AssemblyOriginatorKeyFile>
+    <FileUpgradeFlags>
+    </FileUpgradeFlags>
+    <OldToolsVersion>2.0</OldToolsVersion>
+    <UpgradeBackupLocation>
+    </UpgradeBackupLocation>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <DocumentationFile>
+    </DocumentationFile>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <DocumentationFile>bin\Release\HeuristicLab.Random-3.2.XML</DocumentationFile>
+    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x86\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+    <OutputPath>bin\x86\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <DocumentationFile>bin\Release\HeuristicLab.Random-3.2.XML</DocumentationFile>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x64\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x64</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
+    <OutputPath>bin\x64\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <DocumentationFile>bin\Release\HeuristicLab.Random-3.2.XML</DocumentationFile>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x64</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Drawing" />
+    <Reference Include="System.Windows.Forms" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="UniformRandomAdder.cs" />
+    <Compile Include="NormalRandomAdder.cs" />
+    <Compile Include="HeuristicLabRandomPlugin.cs" />
+    <Compile Include="MersenneTwister.cs" />
+    <Compile Include="NormalDistributedRandom.cs" />
+    <Compile Include="NormalRandomizer.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="RandomInjector.cs" />
+    <Compile Include="UniformRandomizer.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\HeuristicLab.Constraints\3.2\HeuristicLab.Constraints-3.2.csproj">
+      <Project>{FCD62C6F-4793-4593-AE9A-0BDCA256EE99}</Project>
+      <Name>HeuristicLab.Constraints-3.2</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Core\3.2\HeuristicLab.Core-3.2.csproj">
+      <Project>{F43B59AB-2B8C-4570-BC1E-15592086517C}</Project>
+      <Name>HeuristicLab.Core-3.2</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Data\3.2\HeuristicLab.Data-3.2.csproj">
+      <Project>{F473D9AF-3F09-4296-9F28-3C65118DAFFA}</Project>
+      <Name>HeuristicLab.Data-3.2</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Operators\3.2\HeuristicLab.Operators-3.2.csproj">
+      <Project>{A9983BA2-B3B2-475E-8E2C-62050B71D1C5}</Project>
+      <Name>HeuristicLab.Operators-3.2</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\HeuristicLab.PluginInfrastructure.csproj">
+      <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
+      <Name>HeuristicLab.PluginInfrastructure</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="HeuristicLab.snk" />
+    <None Include="Properties\AssemblyInfo.frame" />
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+  <PropertyGroup>
+    <PreBuildEvent>set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
+set ProjectDir=$(ProjectDir)
+set SolutionDir=$(SolutionDir)
+set Outdir=$(Outdir)
+
+call PreBuildEvent.cmd</PreBuildEvent>
+  </PropertyGroup>
+</Project>
Index: /trunk/sources/HeuristicLab.Random/3.3/HeuristicLabRandomPlugin.cs
===================================================================
--- /trunk/sources/HeuristicLab.Random/3.3/HeuristicLabRandomPlugin.cs	(revision 1687)
+++ /trunk/sources/HeuristicLab.Random/3.3/HeuristicLabRandomPlugin.cs	(revision 1687)
@@ -0,0 +1,38 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using HeuristicLab.PluginInfrastructure;
+
+namespace HeuristicLab.Random {
+  /// <summary>
+  /// Plugin class for HeuristicLab.Random plugin.
+  /// </summary>
+  [ClassInfo(Name = "HeuristicLab.Random-3.2")]
+  [PluginFile(Filename = "HeuristicLab.Random-3.2.dll", Filetype = PluginFileType.Assembly)]
+  [Dependency(Dependency = "HeuristicLab.Core-3.2")]
+  [Dependency(Dependency = "HeuristicLab.Data-3.2")]
+  [Dependency(Dependency = "HeuristicLab.Operators-3.2")]
+  public class HeuristicLabRandomPlugin : PluginBase {
+  }
+}
Index: /trunk/sources/HeuristicLab.Random/3.3/MersenneTwister.cs
===================================================================
--- /trunk/sources/HeuristicLab.Random/3.3/MersenneTwister.cs	(revision 1687)
+++ /trunk/sources/HeuristicLab.Random/3.3/MersenneTwister.cs	(revision 1687)
@@ -0,0 +1,287 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+/* 
+ * C# port of the freeware implementation of the Mersenne Twister
+ * originally developed by M. Matsumoto and T. Nishimura
+ * 
+ * M. Matsumoto and T. Nishimura,
+ * "Mersenne Twister: A 623-Dimensionally Equidistributed Uniform
+ * Pseudo-Random Number Generator",
+ * ACM Transactions on Modeling and Computer Simulation,
+ * Vol. 8, No. 1, January 1998, pp 3-30.
+ * 
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using HeuristicLab.Core;
+
+namespace HeuristicLab.Random {
+  /// <summary>
+  /// A 623-Dimensionally Equidistributed Uniform Pseudo-Random Number Generator.
+  /// </summary>
+  public class MersenneTwister : ItemBase, IRandom {
+    private const int n = 624, m = 397;
+
+    private object locker = new object();
+    private uint[] state = new uint[n];
+    private int p = 0;
+    private bool init = false;
+
+    /// <summary>
+    /// Initializes a new instance of <see cref="MersenneTwister"/>.
+    /// </summary>
+    public MersenneTwister() {
+      if (!init) seed((uint)DateTime.Now.Ticks);
+      init = true;
+    }
+    /// <summary>
+    /// Initializes a new instance of <see cref="MersenneTwister"/> 
+    /// with the given seed <paramref name="s"/>.
+    /// </summary>
+    /// <param name="s">The seed with which to initialize the random number generator.</param>
+    public MersenneTwister(uint s) {
+      seed(s);
+      init = true;
+    }
+    /// <summary>
+    /// Initializes a new instance of <see cref="MersenneTwister"/> with the given seed array.
+    /// </summary>
+    /// <param name="array">The seed array with which to initialize the random number generator.</param>
+    public MersenneTwister(uint[] array) {
+      seed(array);
+      init = true;
+    }
+
+    /// <summary>
+    /// Clones the current instance (deep clone).
+    /// </summary>
+    /// <param name="clonedObjects">Dictionary of all already cloned objects. (Needed to avoid cycles.)</param>
+    /// <returns>The cloned object as <see cref="MersenneTwister"/>.</returns>
+    public override object Clone(IDictionary<Guid, object> clonedObjects) {
+      MersenneTwister clone = new MersenneTwister();
+      clonedObjects.Add(Guid, clone);
+      clone.state = (uint[])state.Clone();
+      clone.p = p;
+      clone.init = init;
+      return clone;
+    }
+
+    /// <summary>
+    /// Resets the current random number generator.
+    /// </summary>
+    public void Reset() {
+      lock (locker)
+        seed((uint)DateTime.Now.Ticks);
+    }
+    /// <summary>
+    /// Resets the current random number generator with the given seed <paramref name="s"/>.
+    /// </summary>
+    /// <param name="s">The seed with which to reset the current instance.</param>
+    public void Reset(int s) {
+      lock (locker)
+        seed((uint)s);
+    }
+
+    /// <summary>
+    /// Gets a new random number.
+    /// </summary>
+    /// <returns>A new int random number.</returns>
+    public int Next() {
+      lock (locker) {
+        return (int)(rand_int32() >> 1);
+      }
+    }
+    /// <summary>
+    /// Gets a new random number being smaller than the given <paramref name="maxVal"/>.
+    /// </summary>
+    /// <exception cref="ArgumentException">Thrown when the given maximum value is 
+    /// smaller or equal to zero.</exception>
+    /// <param name="maxVal">The maximum value of the generated random number.</param>
+    /// <returns>A new int random number.</returns>
+    public int Next(int maxVal) {
+      lock (locker) {
+        if (maxVal <= 0)
+          throw new ArgumentException("The interval [0, " + maxVal + ") is empty");
+        int limit = (Int32.MaxValue / maxVal) * maxVal;
+        int value = Next();
+        while (value >= limit) value = Next();
+        return value % maxVal;
+      }
+    }
+    /// <summary>
+    /// Gets a new random number being in the given interval <paramref name="minVal"/> and 
+    /// <paramref name="maxVal"/>.
+    /// </summary>
+    /// <param name="minVal">The minimum value of the generated random number.</param>
+    /// <param name="maxVal">The maximum value of the generated random number.</param>
+    /// <returns>A new int random number.</returns>
+    public int Next(int minVal, int maxVal) {
+      lock (locker) {
+        if (maxVal <= minVal)
+          throw new ArgumentException("The interval [" + minVal + ", " + maxVal + ") is empty");
+        return Next(maxVal - minVal) + minVal;
+      }
+    }
+    /// <summary>
+    /// Gets a new double random variable.
+    /// </summary>
+    /// <returns></returns>
+    public double NextDouble() {
+      lock (locker) {
+        return rand_double53();
+      }
+    }
+
+    #region Persistence Methods
+    /// <summary>
+    /// Saves the current instance as <see cref="XmlNode"/> in the specified <paramref name="document"/>.
+    /// </summary>
+    /// <remarks>The state(s) are saved as child node with the tag <c>State</c>, each state separaated with
+    /// a semicolon. Also the elements <c>p</c> and the <c>init</c> flag are saved as child nodes with 
+    /// tag names <c>P</c> and <c>Init</c> respectively.</remarks>
+    /// <param name="name">The (tag)name of the <see cref="XmlNode"/>.</param>
+    /// <param name="document">The <see cref="XmlDocument"/> where the data is saved.</param>
+    /// <param name="persistedObjects">A dictionary of all already persisted objects. (Needed to avoid cycles.)</param>
+    /// <returns>The saved <see cref="XmlNode"/>.</returns>
+    public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
+      XmlNode node = base.GetXmlNode(name, document, persistedObjects);
+
+      StringBuilder builder = new StringBuilder();
+      builder.Append(state[0]);
+      for (int i = 1; i < state.Length; i++) {
+        builder.Append(';');
+        builder.Append(state[i]);
+      }
+      XmlNode stateNode = document.CreateNode(XmlNodeType.Element, "State", null);
+      stateNode.InnerText = builder.ToString();
+      node.AppendChild(stateNode);
+
+      XmlNode pNode = document.CreateNode(XmlNodeType.Element, "P", null);
+      pNode.InnerText = p.ToString();
+      node.AppendChild(pNode);
+
+      XmlNode initNode = document.CreateNode(XmlNodeType.Element, "Init", null);
+      initNode.InnerText = init.ToString();
+      node.AppendChild(initNode);
+
+      return node;
+    }
+    /// <summary>
+    /// Loads the persisted random number generator from the specified <paramref name="node"/>.
+    /// </summary>
+    /// <remarks>The elements of the current instance must be saved in a special way, see 
+    /// <see cref="GetXmlNode"/>.</remarks>
+    /// <param name="node">The <see cref="XmlNode"/> where the instance is saved.</param>
+    /// <param name="restoredObjects">The dictionary of all already restored objects. (Needed to avoid cycles.)</param>
+    public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
+      base.Populate(node, restoredObjects);
+
+      string stateString = node.SelectSingleNode("State").InnerText;
+      string[] tokens = stateString.Split(';');
+      for (int i = 0; i < tokens.Length; i++)
+        state[i] = uint.Parse(tokens[i]);
+      p = int.Parse(node.SelectSingleNode("P").InnerText);
+      init = bool.Parse(node.SelectSingleNode("Init").InnerText);
+    }
+    #endregion
+
+    #region Seed Methods
+    /// <summary>
+    /// Initializes current instance with random seed.
+    /// </summary>
+    /// <param name="s">A starting seed.</param>
+    public void seed(uint s) {
+      state[0] = s & 0xFFFFFFFFU;
+      for (int i = 1; i < n; ++i) {
+        state[i] = 1812433253U * (state[i - 1] ^ (state[i - 1] >> 30)) + (uint)i;
+        state[i] &= 0xFFFFFFFFU;
+      }
+      p = n;
+    }
+    /// <summary>
+    /// Initializes current instance with random seed.
+    /// </summary>
+    /// <param name="array">A starting seed array.</param>
+    public void seed(uint[] array) {
+      seed(19650218U);
+      int i = 1, j = 0;
+      for (int k = ((n > array.Length) ? n : array.Length); k > 0; --k) {
+        state[i] = (state[i] ^ ((state[i - 1] ^ (state[i - 1] >> 30)) * 1664525U))
+          + array[j] + (uint)j;
+        state[i] &= 0xFFFFFFFFU;
+        ++j;
+        j %= array.Length;
+        if ((++i) == n) { state[0] = state[n - 1]; i = 1; }
+      }
+      for (int k = n - 1; k > 0; --k) {
+        state[i] = (state[i] ^ ((state[i - 1] ^ (state[i - 1] >> 30)) * 1566083941U)) - (uint)i;
+        state[i] &= 0xFFFFFFFFU;
+        if ((++i) == n) { state[0] = state[n - 1]; i = 1; }
+      }
+      state[0] = 0x80000000U;
+      p = n;
+    }
+    #endregion
+
+    #region Random Number Generation Methods
+    private uint rand_int32() {
+      if (p == n) gen_state();
+      uint x = state[p++];
+      x ^= (x >> 11);
+      x ^= (x << 7) & 0x9D2C5680U;
+      x ^= (x << 15) & 0xEFC60000U;
+      return x ^ (x >> 18);
+    }
+    private double rand_double() { // interval [0, 1)
+      return ((double)rand_int32()) * (1.0 / 4294967296.0);
+    }
+    private double rand_double_closed() { // interval [0, 1]
+      return ((double)rand_int32()) * (1.0 / 4294967295.0);
+    }
+    private double rand_double_open() { // interval (0, 1)
+      return (((double)rand_int32()) + 0.5) * (1.0 / 4294967296.0);
+    }
+    private double rand_double53() { // 53 bit resolution, interval [0, 1)
+      return (((double)(rand_int32() >> 5)) * 67108864.0 +
+        ((double)(rand_int32() >> 6))) * (1.0 / 9007199254740992.0);
+    }
+    #endregion
+
+    #region Private Helper Methods
+    private uint twiddle(uint u, uint v) {
+      return (((u & 0x80000000U) | (v & 0x7FFFFFFFU)) >> 1)
+        ^ (((v & 1U) != 0) ? 0x9908B0DFU : 0x0U);
+    }
+    private void gen_state() {
+      for (int i = 0; i < (n - m); ++i)
+        state[i] = state[i + m] ^ twiddle(state[i], state[i + 1]);
+      for (int i = n - m; i < (n - 1); ++i)
+        state[i] = state[i + m - n] ^ twiddle(state[i], state[i + 1]);
+      state[n - 1] = state[m - 1] ^ twiddle(state[n - 1], state[0]);
+      p = 0; // reset position
+    }
+    #endregion
+  }
+}
Index: /trunk/sources/HeuristicLab.Random/3.3/NormalDistributedRandom.cs
===================================================================
--- /trunk/sources/HeuristicLab.Random/3.3/NormalDistributedRandom.cs	(revision 1687)
+++ /trunk/sources/HeuristicLab.Random/3.3/NormalDistributedRandom.cs	(revision 1687)
@@ -0,0 +1,607 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using HeuristicLab.Core;
+using System.Xml;
+using System.Globalization;
+
+namespace HeuristicLab.Random {
+
+  /// <summary>
+  /// Normally distributed random variable.
+  /// Uses the Ziggurat transform to efficiently generate normal distributed random numbers.
+  /// See "The Ziggurat Method for Generating Random Variables" (G. Marsaglia and W.W. Tsang 2000).
+  /// </summary>
+  public class NormalDistributedRandom : ItemBase, IRandom {
+
+    private double mu;
+
+    /// <summary>
+    /// Gets or sets the value for µ.
+    /// </summary>
+    public double Mu {
+      get { return mu; }
+      set { mu = value; }
+    }
+    private double sigma;
+
+    /// <summary>
+    /// Gets or sets the value for sigma.
+    /// </summary>
+    public double Sigma {
+      get { return sigma; }
+      set { sigma = value; }
+    }
+    private IRandom uniform;
+    private double[] w = new double[] {
+      1.7290404664e-09,
+      1.2680928529e-10,
+      1.6897518107e-10,
+      1.9862687883e-10,
+      2.2232431174e-10,
+      2.4244936614e-10,
+      2.6016130916e-10,
+      2.7611987696e-10,
+      2.9073962682e-10,
+      3.0429969655e-10,
+      3.1699795566e-10,
+      3.2898020419e-10,
+      3.4035738117e-10,
+      3.5121602848e-10,
+      3.6162509098e-10,
+      3.7164057942e-10,
+      3.8130856805e-10,
+      3.9066758162e-10,
+      3.9975012189e-10,
+      4.0858399997e-10,
+      4.1719308563e-10,
+      4.2559822333e-10,
+      4.3381759296e-10,
+      4.4186720949e-10,
+      4.4976131153e-10,
+      4.5751258337e-10,
+      4.6513240481e-10,
+      4.7263104541e-10,
+      4.8001774777e-10,
+      4.8730097735e-10,
+      4.9448850570e-10,
+      5.0158732723e-10,
+      5.0860404777e-10,
+      5.1554460700e-10,
+      5.2241466708e-10,
+      5.2921933502e-10,
+      5.3596349581e-10,
+      5.4265170135e-10,
+      5.4928817050e-10,
+      5.5587695558e-10,
+      5.6242188684e-10,
+      5.6892646150e-10,
+      5.7539412124e-10,
+      5.8182819673e-10,
+      5.8823168558e-10,
+      5.9460769641e-10,
+      6.0095900478e-10,
+      6.0728838625e-10,
+      6.1359850534e-10,
+      6.1989202660e-10,
+      6.2617133700e-10,
+      6.3243904558e-10,
+      6.3869737277e-10,
+      6.4494881657e-10,
+      6.5119559745e-10,
+      6.5744004685e-10,
+      6.6368432972e-10,
+      6.6993072201e-10,
+      6.7618144417e-10,
+      6.8243871665e-10,
+      6.8870464887e-10,
+      6.9498151678e-10,
+      7.0127148533e-10,
+      7.0757677495e-10,
+      7.1389966161e-10,
+      7.2024242126e-10,
+      7.2660727435e-10,
+      7.3299660786e-10,
+      7.3941280876e-10,
+      7.4585826404e-10,
+      7.5233547170e-10,
+      7.5884698525e-10,
+      7.6539541372e-10,
+      7.7198347714e-10,
+      7.7861395109e-10,
+      7.8528972214e-10,
+      7.9201378789e-10,
+      7.9878920145e-10,
+      8.0561923799e-10,
+      8.1250728368e-10,
+      8.1945689123e-10,
+      8.2647166888e-10,
+      8.3355555791e-10,
+      8.4071272166e-10,
+      8.4794732347e-10,
+      8.5526402627e-10,
+      8.6266754851e-10,
+      8.7016316375e-10,
+      8.7775620106e-10,
+      8.8545243360e-10,
+      8.9325818964e-10,
+      9.0117996399e-10,
+      9.0922497309e-10,
+      9.1740082198e-10,
+      9.2571583732e-10,
+      9.3417884539e-10,
+      9.4279972718e-10,
+      9.5158891877e-10,
+      9.6055785548e-10,
+      9.6971930486e-10,
+      9.7908692265e-10,
+      9.8867602993e-10,
+      9.9850361313e-10,
+      1.0085882129e-09,
+      1.0189509236e-09,
+      1.0296150599e-09,
+      1.0406069340e-09,
+      1.0519566329e-09,
+      1.0636980186e-09,
+      1.0758701707e-09,
+      1.0885182755e-09,
+      1.1016947354e-09,
+      1.1154610569e-09,
+      1.1298901814e-09,
+      1.1450695947e-09,
+      1.1611052120e-09,
+      1.1781275955e-09,
+      1.1962995039e-09,
+      1.2158286600e-09,
+      1.2369856250e-09,
+      1.2601323318e-09,
+      1.2857697129e-09,
+      1.3146201905e-09,
+      1.3477839955e-09,
+      1.3870635751e-09,
+      1.4357403044e-09,
+      1.5008658760e-09,
+      1.6030947680e-09
+    };
+    private long[] k = new long[] {
+      1991057938,
+      0,
+      1611602771,
+      1826899878,
+      1918584482,
+      1969227037,
+      2001281515,
+      2023368125,
+      2039498179,
+      2051788381,
+      2061460127,
+      2069267110,
+      2075699398,
+      2081089314,
+      2085670119,
+      2089610331,
+      2093034710,
+      2096037586,
+      2098691595,
+      2101053571,
+      2103168620,
+      2105072996,
+      2106796166,
+      2108362327,
+      2109791536,
+      2111100552,
+      2112303493,
+      2113412330,
+      2114437283,
+      2115387130,
+      2116269447,
+      2117090813,
+      2117856962,
+      2118572919,
+      2119243101,
+      2119871411,
+      2120461303,
+      2121015852,
+      2121537798,
+      2122029592,
+      2122493434,
+      2122931299,
+      2123344971,
+      2123736059,
+      2124106020,
+      2124456175,
+      2124787725,
+      2125101763,
+      2125399283,
+      2125681194,
+      2125948325,
+      2126201433,
+      2126441213,
+      2126668298,
+      2126883268,
+      2127086657,
+      2127278949,
+      2127460589,
+      2127631985,
+      2127793506,
+      2127945490,
+      2128088244,
+      2128222044,
+      2128347141,
+      2128463758,
+      2128572095,
+      2128672327,
+      2128764606,
+      2128849065,
+      2128925811,
+      2128994934,
+      2129056501,
+      2129110560,
+      2129157136,
+      2129196237,
+      2129227847,
+      2129251929,
+      2129268426,
+      2129277255,
+      2129278312,
+      2129271467,
+      2129256561,
+      2129233410,
+      2129201800,
+      2129161480,
+      2129112170,
+      2129053545,
+      2128985244,
+      2128906855,
+      2128817916,
+      2128717911,
+      2128606255,
+      2128482298,
+      2128345305,
+      2128194452,
+      2128028813,
+      2127847342,
+      2127648860,
+      2127432031,
+      2127195339,
+      2126937058,
+      2126655214,
+      2126347546,
+      2126011445,
+      2125643893,
+      2125241376,
+      2124799783,
+      2124314271,
+      2123779094,
+      2123187386,
+      2122530867,
+      2121799464,
+      2120980787,
+      2120059418,
+      2119015917,
+      2117825402,
+      2116455471,
+      2114863093,
+      2112989789,
+      2110753906,
+      2108037662,
+      2104664315,
+      2100355223,
+      2094642347,
+      2086670106,
+      2074676188,
+      2054300022,
+      2010539237
+   };
+    private double[] f = new double[] {
+      1.0000000000e+00,
+      9.6359968185e-01,
+      9.3628269434e-01,
+      9.1304361820e-01,
+      8.9228165150e-01,
+      8.7324303389e-01,
+      8.5550057888e-01,
+      8.3878362179e-01,
+      8.2290720940e-01,
+      8.0773830414e-01,
+      7.9317700863e-01,
+      7.7914607525e-01,
+      7.6558417082e-01,
+      7.5244158506e-01,
+      7.3967725039e-01,
+      7.2725689411e-01,
+      7.1515148878e-01,
+      7.0333611965e-01,
+      6.9178915024e-01,
+      6.8049186468e-01,
+      6.6942769289e-01,
+      6.5858197212e-01,
+      6.4794182777e-01,
+      6.3749545813e-01,
+      6.2723249197e-01,
+      6.1714339256e-01,
+      6.0721951723e-01,
+      5.9745317698e-01,
+      5.8783704042e-01,
+      5.7836467028e-01,
+      5.6902998686e-01,
+      5.5982738733e-01,
+      5.5075180531e-01,
+      5.4179835320e-01,
+      5.3296267986e-01,
+      5.2424055338e-01,
+      5.1562821865e-01,
+      5.0712203979e-01,
+      4.9871864915e-01,
+      4.9041482806e-01,
+      4.8220765591e-01,
+      4.7409430146e-01,
+      4.6607214212e-01,
+      4.5813870430e-01,
+      4.5029163361e-01,
+      4.4252872467e-01,
+      4.3484783173e-01,
+      4.2724698782e-01,
+      4.1972434521e-01,
+      4.1227802634e-01,
+      4.0490642190e-01,
+      3.9760786295e-01,
+      3.9038079977e-01,
+      3.8322380185e-01,
+      3.7613546848e-01,
+      3.6911445856e-01,
+      3.6215949059e-01,
+      3.5526937246e-01,
+      3.4844297171e-01,
+      3.4167915583e-01,
+      3.3497685194e-01,
+      3.2833510637e-01,
+      3.2175290585e-01,
+      3.1522938609e-01,
+      3.0876362324e-01,
+      3.0235484242e-01,
+      2.9600214958e-01,
+      2.8970485926e-01,
+      2.8346219659e-01,
+      2.7727350593e-01,
+      2.7113807201e-01,
+      2.6505529881e-01,
+      2.5902456045e-01,
+      2.5304529071e-01,
+      2.4711695313e-01,
+      2.4123899639e-01,
+      2.3541094363e-01,
+      2.2963231802e-01,
+      2.2390270233e-01,
+      2.1822164953e-01,
+      2.1258877218e-01,
+      2.0700371265e-01,
+      2.0146611333e-01,
+      1.9597564638e-01,
+      1.9053204358e-01,
+      1.8513499200e-01,
+      1.7978426814e-01,
+      1.7447963357e-01,
+      1.6922089458e-01,
+      1.6400785744e-01,
+      1.5884037316e-01,
+      1.5371830761e-01,
+      1.4864157140e-01,
+      1.4361007512e-01,
+      1.3862377405e-01,
+      1.3368265331e-01,
+      1.2878671288e-01,
+      1.2393598258e-01,
+      1.1913054436e-01,
+      1.1437050998e-01,
+      1.0965602100e-01,
+      1.0498725623e-01,
+      1.0036443919e-01,
+      9.5787845552e-02,
+      9.1257803142e-02,
+      8.6774669588e-02,
+      8.2338899374e-02,
+      7.7950984240e-02,
+      7.3611505330e-02,
+      6.9321118295e-02,
+      6.5080583096e-02,
+      6.0890771449e-02,
+      5.6752663106e-02,
+      5.2667401731e-02,
+      4.8636294901e-02,
+      4.4660862535e-02,
+      4.0742866695e-02,
+      3.6884389818e-02,
+      3.3087886870e-02,
+      2.9356317595e-02,
+      2.5693291798e-02,
+      2.2103304043e-02,
+      1.8592102453e-02,
+      1.5167297795e-02,
+      1.1839478277e-02,
+      8.6244847625e-03,
+      5.5489949882e-03,
+      2.6696291752e-03
+    };
+
+    /// <summary>
+    /// Initializes a new instance of <see cref="NormalDistributedRandom"/> with µ = 0 and sigma = 1
+    /// and a new random number generator.
+    /// </summary>
+    public NormalDistributedRandom() {
+      this.mu = 0.0;
+      this.sigma = 1.0;
+      this.uniform = new MersenneTwister();
+    }
+
+    /// <summary>
+    /// Initializes a new instance of <see cref="NormalDistributedRandom"/> with the given parameters.
+    /// <note type="caution"> No CopyConstructor! The random number generator is not copied!</note>
+    /// </summary>    
+    /// <param name="uniformRandom">The random number generator.</param>
+    /// <param name="mu">The value for µ.</param>
+    /// <param name="sigma">The value for sigma.</param>
+    public NormalDistributedRandom(IRandom uniformRandom, double mu, double sigma) {
+      this.mu = mu;
+      this.sigma = sigma;
+      this.uniform = uniformRandom;
+    }
+
+    #region IRandom Members
+
+    /// <inheritdoc cref="IRandom.Reset()"/>
+    public void Reset() {
+      uniform.Reset();
+    }
+
+    /// <inheritdoc cref="IRandom.Reset(int)"/>
+    public void Reset(int seed) {
+      uniform.Reset(seed);
+    }
+
+    /// <summary>
+    /// TODO: The method is not implemented.
+    /// </summary>
+    /// <returns>TODO</returns>
+    public int Next() {
+      throw new Exception("The method or operation is not implemented.");
+    }
+
+    /// <summary>
+    /// TODO: The method is not implemented.
+    /// </summary>
+    /// <param name="maxVal">TODO</param>
+    /// <returns>TODO</returns>
+    public int Next(int maxVal) {
+      throw new Exception("The method or operation is not implemented.");
+    }
+
+    /// <summary>
+    /// TODO: The method is not implemented.
+    /// </summary>
+    /// <param name="minVal">TODO</param>
+    /// <param name="maxVal">TODO</param>
+    /// <returns>TODO</returns>
+    public int Next(int minVal, int maxVal) {
+      throw new Exception("The method or operation is not implemented.");
+    }
+
+    /// <summary>
+    /// Generates a new double random number.
+    /// </summary>
+    /// <returns>A double random number.</returns>
+    public double NextDouble() {
+      double signFactor = uniform.Next()%2==0?1.0:-1.0;
+      return sigma* signFactor * NextPositiveDouble() + mu;
+    }
+
+    private double NextPositiveDouble() {
+      int j = uniform.Next();
+      int i = (j & 127);
+      if(Math.Abs(j) < k[i]) {
+        return j * w[i];
+      } else {
+        double r = 3.442620;
+        double x, y;
+        x = j * w[i];
+        if(i == 0) {
+          do {
+            x = -Math.Log(ScaledUniform()) * 0.2904764;
+            y = -Math.Log(ScaledUniform());
+          } while(y + y < x * x);
+          return (j > 0) ? r + x : -r - x;
+        }
+        if(f[i] + ScaledUniform() * (f[i - 1] - f[i]) < Math.Exp(-0.5 * x * x)) {
+          return x;
+        } else {
+          // recurse
+          return (NextPositiveDouble());
+        }
+      }
+    }
+
+    private double ScaledUniform() {
+      return 0.5 + uniform.Next() * 0.2328306e-9;
+    }
+
+
+    #endregion
+
+    #region persistence
+    /// <summary>
+    /// Saves the current instance as <see cref="XmlNode"/> in the specified <paramref name="document"/>.
+    /// </summary>
+    /// <remarks>The value of µ and sigma are saved as child nodes with tag names <c>Mu</c> and <c>Sigma</c>,
+    /// also the random number generator is saved as a child node with tag name <c>UniformRandom</c>.</remarks>
+    /// <param name="name">The (tag)name of the <see cref="XmlNode"/>.</param>
+    /// <param name="document">The <see cref="XmlDocument"/> where the data is saved.</param>
+    /// <param name="persistedObjects">A dictionary of all already persisted objects. (Needed to avoid cycles.)</param>
+    /// <returns>The saved <see cref="XmlNode"/>.</returns>
+    public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
+      XmlNode node = base.GetXmlNode(name, document, persistedObjects);
+
+      XmlNode muNode = document.CreateNode(XmlNodeType.Element, "Mu", null);
+      muNode.InnerText = mu.ToString("r", CultureInfo.InvariantCulture);
+      node.AppendChild(muNode);
+
+      XmlNode sigmaNode = document.CreateNode(XmlNodeType.Element, "Sigma", null);
+      sigmaNode.InnerText = sigma.ToString("r", CultureInfo.InvariantCulture);
+      node.AppendChild(sigmaNode);
+
+      node.AppendChild(PersistenceManager.Persist("UniformRandom", uniform, document, persistedObjects));
+
+      return node;
+    }
+
+    /// <summary>
+    /// Loads the persisted normally distributed random variable from the specified <paramref name="node"/>.
+    /// </summary>
+    /// <remarks>The elements of the current instance must be saved in a special way, see 
+    /// <see cref="GetXmlNode"/>.</remarks>
+    /// <param name="node">The <see cref="XmlNode"/> where the instance is saved.</param>
+    /// <param name="restoredObjects">The dictionary of all already restored objects. (Needed to avoid cycles.)</param>
+    public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
+      base.Populate(node, restoredObjects);
+
+      mu = double.Parse(node.SelectSingleNode("Mu").InnerText, CultureInfo.InvariantCulture);
+      sigma = double.Parse(node.SelectSingleNode("Sigma").InnerText, CultureInfo.InvariantCulture);
+      uniform = (IRandom)PersistenceManager.Restore(node.SelectSingleNode("UniformRandom"), restoredObjects);
+    }
+
+    /// <summary>
+    /// Clones the current instance (deep clone).
+    /// </summary>
+    /// <remarks>Deep clone through <see cref="Auxiliary.Clone"/> method of helper class 
+    /// <see cref="Auxiliary"/>.</remarks>
+    /// <param name="clonedObjects">Dictionary of all already cloned objects. (Needed to avoid cycles.)</param>
+    /// <returns>The cloned object as <see cref="NormalDistributedRandom"/>.</returns>
+    public override object Clone(IDictionary<Guid, object> clonedObjects) {
+      NormalDistributedRandom clone = new NormalDistributedRandom((IRandom)Auxiliary.Clone(uniform, clonedObjects), mu, sigma);
+      clonedObjects.Add(Guid, clone);
+      return clone;
+    }
+
+    #endregion
+  }
+}
Index: /trunk/sources/HeuristicLab.Random/3.3/NormalRandomAdder.cs
===================================================================
--- /trunk/sources/HeuristicLab.Random/3.3/NormalRandomAdder.cs	(revision 1687)
+++ /trunk/sources/HeuristicLab.Random/3.3/NormalRandomAdder.cs	(revision 1687)
@@ -0,0 +1,180 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Constraints;
+
+namespace HeuristicLab.Random {
+  /// <summary>
+  /// Normally distributed random number generator that adds the generated value to the existing value
+  /// in the specified scope.
+  /// </summary>
+  public class NormalRandomAdder : OperatorBase {
+    private static int MAX_NUMBER_OF_TRIES = 100;
+
+    /// <inheritdoc select="summary"/>
+    public override string Description {
+      get {
+        return @"Samples a normally distributed (mu, sigma * shakingFactor) random variable and adds the result to variable 'Value'.
+        
+If a constraint for the allowed range of 'Value' is defined and the result of the operation would be smaller then 
+the smallest allowed value then 'Value' is set to the lower bound and vice versa for the upper bound.";
+      }
+    }
+
+    /// <summary>
+    /// Gets or sets the value for µ.
+    /// </summary>
+    /// <remarks>Gets or sets the variable with the name <c>Mu</c> through the method 
+    /// <see cref="OperatorBase.GetVariable"/> of class <see cref="OperatorBase"/>.</remarks>
+    public double Mu {
+      get { return ((DoubleData)GetVariable("Mu").Value).Data; }
+      set { ((DoubleData)GetVariable("Mu").Value).Data = value; }
+    }
+    /// <summary>
+    /// Gets or sets the value for sigma.
+    /// </summary>
+    /// <remarks>Gets or sets the variable with the name <c>Sigma</c> through the method 
+    /// <see cref="OperatorBase.GetVariable"/> of class <see cref="OperatorBase"/>.</remarks>
+    public double Sigma {
+      get { return ((DoubleData)GetVariable("Sigma").Value).Data; }
+      set { ((DoubleData)GetVariable("Sigma").Value).Data = value; }
+    }
+
+    /// <summary>
+    /// Initializes a new instance of <see cref="NormalRandomAdder"/> with five variable infos
+    /// (<c>Mu</c>, <c>Sigma</c>, <c>Value</c>, <c>ShakingFactor</c> and <c>Random</c>).
+    /// </summary>
+    public NormalRandomAdder() {
+      AddVariableInfo(new VariableInfo("Mu", "Parameter mu of the normal distribution", typeof(DoubleData), VariableKind.None));
+      GetVariableInfo("Mu").Local = true;
+      AddVariable(new Variable("Mu", new DoubleData(0.0)));
+
+      AddVariableInfo(new VariableInfo("Sigma", "Parameter sigma of the normal distribution", typeof(DoubleData), VariableKind.None));
+      GetVariableInfo("Sigma").Local = true;
+      AddVariable(new Variable("Sigma", new DoubleData(1.0)));
+
+      AddVariableInfo(new VariableInfo("Value", "The value to manipulate (actual type is one of: IntData, DoubleData, ConstrainedIntData, ConstrainedDoubleData)", typeof(IObjectData), VariableKind.In));
+      AddVariableInfo(new VariableInfo("ShakingFactor", "Determines the force of the shaking factor (effective sigma = sigma * shakingFactor)", typeof(DoubleData), VariableKind.In));
+      AddVariableInfo(new VariableInfo("Random", "The random generator to use", typeof(MersenneTwister), VariableKind.In));
+    }
+
+    /// <summary>
+    /// Generates a new normally distributed random number and adds it to the specified value in the
+    /// given <paramref name="scope"/>.
+    /// </summary>
+    /// <param name="scope">The scope where to add the generated random number.</param>
+    /// <returns><c>null</c>.</returns>
+    public override IOperation Apply(IScope scope) {
+      IObjectData value = GetVariableValue<IObjectData>("Value", scope, false);
+      MersenneTwister mt = GetVariableValue<MersenneTwister>("Random", scope, true);
+      double factor = GetVariableValue<DoubleData>("ShakingFactor", scope, true).Data;
+      double mu = GetVariableValue<DoubleData>("Mu", scope, true).Data;
+      double sigma = GetVariableValue<DoubleData>("Sigma", scope, true).Data;
+      NormalDistributedRandom normal = new NormalDistributedRandom(mt, mu, sigma * factor);
+
+      AddNormal(value, normal);
+      return null;
+    }
+
+    private void AddNormal(IObjectData value, NormalDistributedRandom normal) {
+      // dispatch manually based on dynamic type
+      if (value is IntData)
+        AddNormal((IntData)value, normal);
+      else if (value is ConstrainedIntData)
+        AddNormal((ConstrainedIntData)value, normal);
+      else if (value is ConstrainedDoubleData)
+        AddNormal((ConstrainedDoubleData)value, normal);
+      else if (value is DoubleData)
+        AddNormal((DoubleData)value, normal);
+      else throw new InvalidOperationException("Can't handle type " + value.GetType().Name);
+    }
+    /// <summary>
+    /// Generates a new double random number and adds it to the value of 
+    /// the given <paramref name="data"/>.
+    /// </summary>
+    /// <param name="data">The double object where to add the random number.</param>
+    /// <param name="normal">The continuous, normally distributed random variable.</param>
+    public void AddNormal(DoubleData data, NormalDistributedRandom normal) {
+      data.Data += normal.NextDouble();
+    }
+
+    /// <summary>
+    /// Generates a new double random number and adds it to the value of the given <paramref name="data"/>
+    /// checking its constraints.
+    /// </summary>
+    /// <exception cref="InvalidProgramException">Thrown when with the current settings no valid value
+    /// could be found.</exception>
+    /// <param name="data">The double object where to add the random number and whose constraints
+    /// to fulfill.</param>
+    /// <param name="normal">The continuous, normally distributed random variable.</param>
+    public void AddNormal(ConstrainedDoubleData data, NormalDistributedRandom normal) {
+      for (int tries = MAX_NUMBER_OF_TRIES; tries >= 0; tries--) {
+        double newValue = data.Data + normal.NextDouble();
+        if (IsIntegerConstrained(data)) {
+          newValue = Math.Round(newValue);
+        }
+        if (data.TrySetData(newValue)) {
+          return;
+        }
+      }
+      throw new InvalidProgramException("Coudn't find a valid value");
+    }
+
+    /// <summary>
+    /// Generates a new int random number and adds it to value of the given <paramref name="data"/>.
+    /// </summary>
+    /// <param name="data">The int object where to add the random number.</param>
+    /// <param name="normal">The continuous, normally distributed random variable.</param>
+    public void AddNormal(IntData data, NormalDistributedRandom normal) {
+      data.Data = (int)Math.Round(data.Data + normal.NextDouble());
+    }
+
+    /// <summary>
+    /// Generates a new int random number and adds it to the value of the given <paramref name="data"/>
+    /// checking its constraints.
+    /// </summary>
+    /// <exception cref="InvalidProgramException">Thrown when with the current settings no valid value 
+    /// could be found.</exception>
+    /// <param name="data">The int object where to add the generated value and whose contraints to check.</param>
+    /// <param name="normal">The continuous, normally distributed random variable.</param>
+    public void AddNormal(ConstrainedIntData data, NormalDistributedRandom normal) {
+      for (int tries = MAX_NUMBER_OF_TRIES; tries >= 0; tries--) {
+        if (data.TrySetData((int)Math.Round(data.Data + normal.NextDouble())))
+          return;
+      }
+      throw new InvalidProgramException("Couldn't find a valid value.");
+    }
+
+    private bool IsIntegerConstrained(ConstrainedDoubleData data) {
+      foreach (IConstraint constraint in data.Constraints) {
+        if (constraint is IsIntegerConstraint) {
+          return true;
+        }
+      }
+      return false;
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.Random/3.3/NormalRandomizer.cs
===================================================================
--- /trunk/sources/HeuristicLab.Random/3.3/NormalRandomizer.cs	(revision 1687)
+++ /trunk/sources/HeuristicLab.Random/3.3/NormalRandomizer.cs	(revision 1687)
@@ -0,0 +1,178 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Constraints;
+
+namespace HeuristicLab.Random {
+  /// <summary>
+  /// Normally distributed random number generator.
+  /// </summary>
+  public class NormalRandomizer : OperatorBase {
+    private static int MAX_NUMBER_OF_TRIES = 100;
+
+    /// <inheritdoc select="summary"/>
+    public override string Description {
+      get { return "Initializes the value of variable 'Value' to a random value normally distributed with 'Mu' and 'Sigma'."; }
+    }
+
+    /// <summary>
+    /// Gets or sets the value for µ.
+    /// </summary>
+    /// <remarks>Gets or sets the variable with the name <c>Mu</c> through the method 
+    /// <see cref="OperatorBase.GetVariable"/> of class <see cref="OperatorBase"/>.</remarks>
+    public double Mu {
+      get { return ((DoubleData)GetVariable("Mu").Value).Data; }
+      set { ((DoubleData)GetVariable("Mu").Value).Data = value; }
+    }
+    /// <summary>
+    /// Gets or sets the value for sigma.
+    /// </summary>
+    /// <remarks>Gets or sets the variable with the name <c>Sigma</c> through the method 
+    /// <see cref="OperatorBase.GetVariable"/> of class <see cref="OperatorBase"/>.</remarks>
+    public double Sigma {
+      get { return ((DoubleData)GetVariable("Sigma").Value).Data; }
+      set { ((DoubleData)GetVariable("Sigma").Value).Data = value; }
+    }
+
+    /// <summary>
+    /// Initializes a new instance of <see cref="NormalRandomizer"/> with four variable infos
+    /// (<c>Mu</c>, <c>Sigma</c>, <c>Value</c> and <c>Random</c>).
+    /// </summary>
+    public NormalRandomizer() {
+      AddVariableInfo(new VariableInfo("Mu", "Parameter mu of the normal distribution", typeof(DoubleData), VariableKind.None));
+      GetVariableInfo("Mu").Local = true;
+      AddVariable(new Variable("Mu", new DoubleData(0.0)));
+
+      AddVariableInfo(new VariableInfo("Sigma", "Parameter sigma of the normal distribution", typeof(DoubleData), VariableKind.None));
+      GetVariableInfo("Sigma").Local = true;
+      AddVariable(new Variable("Sigma", new DoubleData(1.0)));
+
+      AddVariableInfo(new VariableInfo("Value", "The value to manipulate (actual type is one of: IntData, DoubleData, ConstrainedIntData, ConstrainedDoubleData)", typeof(IObjectData), VariableKind.In));
+      AddVariableInfo(new VariableInfo("Random", "The random generator to use", typeof(MersenneTwister), VariableKind.In));
+    }
+
+    /// <summary>
+    /// Generates a new normally distributed random variable and assigns it to the specified variable
+    /// in the given <paramref name="scope"/>.
+    /// </summary>
+    /// <param name="scope">The scope where to assign the new random value to.</param>
+    /// <returns><c>null</c>.</returns>
+    public override IOperation Apply(IScope scope) {
+      IObjectData value = GetVariableValue<IObjectData>("Value", scope, false);
+      MersenneTwister mt = GetVariableValue<MersenneTwister>("Random", scope, true);
+      double mu = GetVariableValue<DoubleData>("Mu", scope, true).Data;
+      double sigma = GetVariableValue<DoubleData>("Sigma", scope, true).Data;
+
+      NormalDistributedRandom n = new NormalDistributedRandom(mt, mu, sigma);
+      RandomizeNormal(value, n);
+      return null;
+    }
+
+    private void RandomizeNormal(IObjectData value, NormalDistributedRandom n) {
+      // dispatch manually based on dynamic type
+      if (value is IntData)
+        RandomizeNormal((IntData)value, n);
+      else if (value is ConstrainedIntData)
+        RandomizeNormal((ConstrainedIntData)value, n);
+      else if (value is DoubleData)
+        RandomizeNormal((DoubleData)value, n);
+      else if (value is ConstrainedDoubleData)
+        RandomizeNormal((ConstrainedDoubleData)value, n);
+      else throw new InvalidOperationException("Can't handle type " + value.GetType().Name);
+    }
+
+    /// <summary>
+    /// Generates a new double random variable based on a continuous, normally distributed random number generator
+    /// <paramref name="normal"/> and checks some contraints.
+    /// </summary>
+    /// <exception cref="InvalidOperationException">Thrown when with the given settings no valid value in
+    /// 100 tries could be found.
+    /// </exception>
+    /// <param name="data">The double object where to assign the new number to and whose constraints
+    /// must be fulfilled.</param>
+    /// <param name="normal">The continuous, normally distributed random variable.</param>
+    public void RandomizeNormal(ConstrainedDoubleData data, NormalDistributedRandom normal) {
+      for (int tries = MAX_NUMBER_OF_TRIES; tries >= 0; tries--) {
+        double r = normal.NextDouble();
+        if (IsIntegerConstrained(data)) {
+          r = Math.Round(r);
+        }
+        if (data.TrySetData(r)) {
+          return;
+        }
+      }
+      throw new InvalidOperationException("Couldn't find a valid value in 100 tries with mu=" + normal.Mu + " sigma=" + normal.Sigma);
+    }
+
+    /// <summary>
+    /// Generates a new int random variable based on a continuous, normally distributed random number 
+    /// generator <paramref name="normal"/> and checks some constraints.
+    /// </summary>
+    /// <exception cref="InvalidOperationException">Thrown when with the given settings no valid
+    /// value could be found.</exception>
+    /// <param name="data">The int object where to assign the new value to and whose constraints must
+    /// be fulfilled.</param>
+    /// <param name="normal">The continuous, normally distributed random variable.</param>
+    public void RandomizeNormal(ConstrainedIntData data, NormalDistributedRandom normal) {
+      for (int tries = MAX_NUMBER_OF_TRIES; tries >= 0; tries--) {
+        double r = normal.NextDouble();
+        if (data.TrySetData((int)Math.Round(r))) // since r is a continuous, normally distributed random variable rounding should be OK
+          return;
+      }
+      throw new InvalidOperationException("Couldn't find a valid value");
+    }
+
+    /// <summary>
+    /// Generates a new double random number based on a continuous, normally distributed random number
+    /// generator <paramref name="normal"/>.
+    /// </summary>
+    /// <param name="data">The double object where to assign the new value to.</param>
+    /// <param name="normal">The continuous, normally distributed random variable.</param>
+    public void RandomizeNormal(DoubleData data, NormalDistributedRandom normal) {
+      data.Data = normal.NextDouble();
+    }
+
+    /// <summary>
+    /// Generates a new int random number based on a continuous, normally distributed random number 
+    /// generator <paramref name="normal"/>.
+    /// </summary>
+    /// <param name="data">The int object where to assign the new value to.</param>
+    /// <param name="normal">The continuous, normally distributed random variable.</param>
+    public void RandomizeNormal(IntData data, NormalDistributedRandom normal) {
+      data.Data = (int)Math.Round(normal.NextDouble());
+    }
+
+
+    private bool IsIntegerConstrained(ConstrainedDoubleData data) {
+      foreach (IConstraint constraint in data.Constraints) {
+        if (constraint is IsIntegerConstraint) {
+          return true;
+        }
+      }
+      return false;
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.Random/3.3/Properties/AssemblyInfo.frame
===================================================================
--- /trunk/sources/HeuristicLab.Random/3.3/Properties/AssemblyInfo.frame	(revision 1687)
+++ /trunk/sources/HeuristicLab.Random/3.3/Properties/AssemblyInfo.frame	(revision 1687)
@@ -0,0 +1,58 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using HeuristicLab.PluginInfrastructure;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("HeuristicLab.Random")]
+[assembly: AssemblyDescription("HeuristicLab random number generation classes")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("HeuristicLab")]
+[assembly: AssemblyCopyright("(c) 2002-2008 HEAL")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("fc20091c-d28c-4999-940b-5f4029c1ca33")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers 
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("3.2.0.$WCREV$")]
+[assembly: AssemblyFileVersion("3.2.0.$WCREV$")]
+[assembly: AssemblyBuildDate("$WCNOW$")]
Index: /trunk/sources/HeuristicLab.Random/3.3/RandomInjector.cs
===================================================================
--- /trunk/sources/HeuristicLab.Random/3.3/RandomInjector.cs	(revision 1687)
+++ /trunk/sources/HeuristicLab.Random/3.3/RandomInjector.cs	(revision 1687)
@@ -0,0 +1,76 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Operators;
+
+namespace HeuristicLab.Random {
+  /// <summary>
+  /// Injects a random variable in a given scope.
+  /// </summary>
+  public class RandomInjector : OperatorBase {
+    /// <inheritdoc select="summary"/>
+    public override string Description {
+      get { return @"TODO\r\nOperator description still missing ..."; }
+    }
+
+    /// <summary>
+    /// Initializes a new instance of <see cref="RandomInjector"/> with three variable infos
+    /// (<c>SetSeedRandomly</c>, <c>Seed</c> and <c>Random</c>.)
+    /// </summary>
+    public RandomInjector()
+      : base() {
+      AddVariableInfo(new VariableInfo("SetSeedRandomly", "Initialize random seed randomly", typeof(BoolData), VariableKind.In));
+      GetVariableInfo("SetSeedRandomly").Local = true;
+      AddVariable(new Variable("SetSeedRandomly", new BoolData(true)));
+
+      AddVariableInfo(new VariableInfo("Seed", "Random seed", typeof(IntData), VariableKind.In));
+      GetVariableInfo("Seed").Local = true;
+      System.Random random = new System.Random();
+      AddVariable(new Variable("Seed", new IntData(random.Next())));
+
+      AddVariableInfo(new VariableInfo("Random", "Pseudo random number generator", typeof(IRandom), VariableKind.New));
+    }
+
+    /// <summary>
+    /// Injects a new random variable in the given <paramref name="scope"/> .
+    /// </summary>
+    /// <param name="scope">The scope where to inject the variable.</param>
+    /// <returns><c>null</c>.</returns>
+    public override IOperation Apply(IScope scope) {
+      bool setRandomly = GetVariableValue<BoolData>("SetSeedRandomly", scope, true).Data;
+      IntData seed = GetVariableValue<IntData>("Seed", scope, true);
+      if (setRandomly) {
+        System.Random random = new System.Random();
+        seed.Data = random.Next();
+      }
+      MersenneTwister mersenneTwister = new MersenneTwister((uint)seed.Data);
+
+      scope.AddVariable(new Variable(scope.TranslateName("Random"), mersenneTwister));
+      return null;
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.Random/3.3/UniformRandomAdder.cs
===================================================================
--- /trunk/sources/HeuristicLab.Random/3.3/UniformRandomAdder.cs	(revision 1687)
+++ /trunk/sources/HeuristicLab.Random/3.3/UniformRandomAdder.cs	(revision 1687)
@@ -0,0 +1,179 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Constraints;
+
+namespace HeuristicLab.Random {
+  /// <summary>
+  /// Uniformly distributed random number generator that adds the generated value to the existing one.
+  /// </summary>
+  public class UniformRandomAdder : OperatorBase {
+
+    private static int MAX_NUMBER_OF_TRIES = 100;
+
+    /// <inheritdoc select="summary"/>
+    public override string Description {
+      get {
+        return @"Samples a uniformly distributed random variable 'U' with range = [min,max] and E(u) = (max-min)/2
+and adds the result to the variable 'Value'. ShakingFactor influences the effective range of U. 
+If r=(max-min) then the effective range of U is [E(u) - shakingFactor * r/2, E(u) + shakingFactor * r/2].
+
+If a constraint for the allowed range of 'Value' is defined and the result of the operation would be smaller then 
+the smallest allowed value then 'Value' is set to the lower bound and vice versa for the upper bound.";
+      }
+    }
+
+    /// <summary>
+    /// Initializes a new instance of <see cref="UniformRandomAdder"/> with five variable infos
+    /// (<c>Value</c>, <c>ShakingFactor</c>, <c>Random</c>, <c>Min</c> and <c>Max</c>), having an interval
+    /// of -1.0 to 1.0.
+    /// </summary>
+    public UniformRandomAdder() {
+      AddVariableInfo(new VariableInfo("Value", "The value to manipulate (type is one of: IntData, ConstrainedIntData, DoubleData, ConstrainedDoubleData)", typeof(IObjectData), VariableKind.In));
+      AddVariableInfo(new VariableInfo("ShakingFactor", "Determines the force of the shaking factor", typeof(DoubleData), VariableKind.In));
+      AddVariableInfo(new VariableInfo("Random", "The random generator to use", typeof(MersenneTwister), VariableKind.In));
+      AddVariableInfo(new VariableInfo("Min", "Lower bound of the uniform distribution (inclusive)", typeof(DoubleData), VariableKind.None));
+      GetVariableInfo("Min").Local = true;
+      AddVariable(new Variable("Min", new DoubleData(-1.0)));
+
+      AddVariableInfo(new VariableInfo("Max", "Upper bound of the uniform distribution (exclusive)", typeof(DoubleData), VariableKind.None));
+      GetVariableInfo("Max").Local = true;
+      AddVariable(new Variable("Max", new DoubleData(1.0)));
+    }
+
+    /// <summary>
+    /// Generates a new uniformly distributed random number and adds it to the value in the given
+    /// <paramref name="scope"/>.
+    /// </summary>
+    /// <param name="scope">The current scope where to add the generated random number.</param>
+    /// <returns><c>null</c>.</returns>
+    public override IOperation Apply(IScope scope) {
+      IObjectData value = GetVariableValue<IObjectData>("Value", scope, false);
+      MersenneTwister mt = GetVariableValue<MersenneTwister>("Random", scope, true);
+      double factor = GetVariableValue<DoubleData>("ShakingFactor", scope, true).Data;
+      double min = GetVariableValue<DoubleData>("Min", scope, true).Data;
+      double max = GetVariableValue<DoubleData>("Max", scope, true).Data;
+
+      double ex = (max - min) / 2.0 + min;
+      double newRange = (max - min) * factor;
+      min = ex - newRange / 2;
+      max = ex + newRange / 2;
+
+      AddUniform(value, mt, min, max);
+      return null;
+    }
+
+    private void AddUniform(IObjectData value, MersenneTwister mt, double min, double max) {
+      // dispatch manually on dynamic type
+      if (value is IntData)
+        AddUniform((IntData)value, mt, min, max);
+      else if (value is ConstrainedIntData)
+        AddUniform((ConstrainedIntData)value, mt, min, max);
+      else if (value is DoubleData)
+        AddUniform((DoubleData)value, mt, min, max);
+      else if (value is ConstrainedDoubleData)
+        AddUniform((ConstrainedDoubleData)value, mt, min, max);
+      else throw new InvalidOperationException("Can't handle type " + value.GetType().Name);
+    }
+
+    /// <summary>
+    /// Adds a new double random variable being restricted to some constraints to the value of the given 
+    /// <paramref name="data"/>.
+    /// </summary>
+    /// <exception cref="InvalidProgramException">Thrown when no valid value can be found.</exception>
+    /// <param name="data">The data where to add the new variable and where to assign the new value to.</param>
+    /// <param name="mt">The random number generator.</param>
+    /// <param name="min">The left border of the interval in which the next random number has to lie.</param>
+    /// <param name="max">The right border (exclusive) of the interval in which the next random number
+    /// has to lie.</param>
+    public void AddUniform(ConstrainedDoubleData data, MersenneTwister mt, double min, double max) {
+      for (int tries = MAX_NUMBER_OF_TRIES; tries >= 0; tries--) {
+        double newValue = data.Data + mt.NextDouble() * (max - min) + min;
+        if (IsIntegerConstrained(data)) {
+          newValue = Math.Floor(newValue);
+        }
+        if (data.TrySetData(newValue)) {
+          return;
+        }
+      }
+      throw new InvalidProgramException("Couldn't find a valid value");
+    }
+
+    /// <summary>
+    /// Adds a new int random variable being restricted to some constraints to the value of the given
+    /// <paramref name="data"/>.
+    /// </summary>
+    /// <exception cref="InvalidProgramException">Thrown when no valid value could be found.</exception>
+    /// <param name="data">The data where to add the random value and where to assign the new value to.</param>
+    /// <param name="mt">The random number generator.</param>
+    /// <param name="min">The left border of the interval in which the next random number has to lie.</param>
+    /// <param name="max">The right border (exclusive) of the interval in which the next random number
+    /// has to lie.</param>
+    public void AddUniform(ConstrainedIntData data, MersenneTwister mt, double min, double max) {
+      for (int tries = MAX_NUMBER_OF_TRIES; tries >= 0; tries--) {
+        int newValue = (int)Math.Floor(data.Data + mt.NextDouble() * (max - min) + min);
+        if (data.TrySetData(newValue)) {
+          return;
+        }
+      }
+      throw new InvalidProgramException("Couldn't find a valid value");
+    }
+
+    /// <summary>
+    /// Generates a new double random variable and adds it to the value of 
+    /// the given <paramref name="data"/>.
+    /// </summary>
+    /// <param name="data">The double object where to add the random value.</param>
+    /// <param name="mt">The random number generator.</param>
+    /// <param name="min">The left border of the interval in which the next random number has to lie.</param>
+    /// <param name="max">The right border (exclusive) of the interval in which the next random number
+    /// has to lie.</param>
+    public void AddUniform(DoubleData data, MersenneTwister mt, double min, double max) {
+      data.Data = data.Data + mt.NextDouble() * (max - min) + min;
+    }
+
+    /// <summary>
+    /// Generates a new int random variable and adds it to the value of the given
+    /// <paramref name="data"/>.
+    /// </summary>
+    /// <param name="data">The int object where to add the random value.</param>
+    /// <param name="mt">The random number generator.</param>
+    /// <param name="min">The left border of the interval in which the next random number has to lie.</param>
+    /// <param name="max">The right border (exclusive) of the interval in which the next random number
+    /// has to lie.</param>
+    public void AddUniform(IntData data, MersenneTwister mt, double min, double max) {
+      data.Data = (int)Math.Floor(data.Data + mt.NextDouble() * (max - min) + min);
+    }
+    private bool IsIntegerConstrained(ConstrainedDoubleData data) {
+      foreach (IConstraint constraint in data.Constraints) {
+        if (constraint is IsIntegerConstraint) {
+          return true;
+        }
+      }
+      return false;
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.Random/3.3/UniformRandomizer.cs
===================================================================
--- /trunk/sources/HeuristicLab.Random/3.3/UniformRandomizer.cs	(revision 1687)
+++ /trunk/sources/HeuristicLab.Random/3.3/UniformRandomizer.cs	(revision 1687)
@@ -0,0 +1,189 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Constraints;
+
+namespace HeuristicLab.Random {
+  /// <summary>
+  /// Uniformly distributed random number generator.
+  /// </summary>
+  public class UniformRandomizer : OperatorBase {
+    private static int MAX_NUMBER_OF_TRIES = 100;
+    /// <inheritdoc select="summary"/>
+    public override string Description {
+      get { return "Initializes the value of variable 'Value' to a random value uniformly distributed between 'Min' and 'Max' (exclusive)"; }
+    }
+
+    /// <summary>
+    /// Gets or sets the maximum value of the random number generator (exclusive).
+    /// </summary>
+    /// <remarks>Gets or sets the variable with name <c>Max</c> through the 
+    /// <see cref="OperatorBase.GetVariable"/> method of class <see cref="OperatorBase"/>.</remarks>
+    public double Max {
+      get { return ((DoubleData)GetVariable("Max").Value).Data; }
+      set { ((DoubleData)GetVariable("Max").Value).Data = value; }
+    }
+    /// <summary>
+    /// Gets or sets the minimum value of the random number generator.
+    /// </summary>
+    /// <remarks>Gets or sets the variable with name <c>Min</c> through the 
+    /// <see cref="OperatorBase.GetVariable"/> method of class <see cref="OperatorBase"/>.</remarks>
+    public double Min {
+      get { return ((DoubleData)GetVariable("Min").Value).Data; }
+      set { ((DoubleData)GetVariable("Min").Value).Data = value; }
+    }
+
+    /// <summary>
+    /// Initializes a new instance of <see cref="UniformRandomizer"/> with four variable infos 
+    /// (<c>Value</c>, <c>Random</c>, <c>Max</c> and <c>Min</c>), being a random number generator 
+    /// between 0.0 and 1.0.
+    /// </summary>
+    public UniformRandomizer() {
+      AddVariableInfo(new VariableInfo("Value", "The value to manipulate (type is one of: IntData, ConstrainedIntData, DoubleData, ConstrainedDoubleData)", typeof(IObjectData), VariableKind.In));
+      AddVariableInfo(new VariableInfo("Random", "The random generator to use", typeof(MersenneTwister), VariableKind.In));
+      AddVariableInfo(new VariableInfo("Min", "Lower bound of the uniform distribution (inclusive)", typeof(DoubleData), VariableKind.None));
+      GetVariableInfo("Min").Local = true;
+      AddVariable(new Variable("Min", new DoubleData(0.0)));
+
+      AddVariableInfo(new VariableInfo("Max", "Upper bound of the uniform distribution (exclusive)", typeof(DoubleData), VariableKind.None));
+      GetVariableInfo("Max").Local = true;
+      AddVariable(new Variable("Max", new DoubleData(1.0)));
+    }
+
+    /// <summary>
+    /// Generates a new uniformly distributed random variable.
+    /// </summary>
+    /// <param name="scope">The scope where to apply the random number generator.</param>
+    /// <returns><c>null</c>.</returns>
+    public override IOperation Apply(IScope scope) {
+      IObjectData value = GetVariableValue<IObjectData>("Value", scope, false);
+      MersenneTwister mt = GetVariableValue<MersenneTwister>("Random", scope, true);
+      double min = GetVariableValue<DoubleData>("Min", scope, true).Data;
+      double max = GetVariableValue<DoubleData>("Max", scope, true).Data;
+
+      RandomizeUniform(value, mt, min, max);
+      return null;
+    }
+
+    /// <summary>
+    /// Generates a new random number depending on the type of the <paramref name="value"/>.
+    /// </summary>
+    /// <exception cref="ArgumentException">Thrown when an unhandleable type appears.</exception>
+    /// <param name="value">The object whose data should be a new randomly generated number.</param>
+    /// <param name="mt">The MersenneTwister to generate a new random number.</param>
+    /// <param name="min">The left border of the interval in which the next random number has to lie.</param>
+    /// <param name="max">The right border (exclusive) of the interval in which the next random number
+    /// has to lie.</param>
+    private void RandomizeUniform(IObjectData value, MersenneTwister mt, double min, double max) {
+      // Dispatch manually based on dynamic type,
+      // a bit awkward but necessary until we create a better type hierarchy for numeric types (gkronber 15.11.2008).
+      if (value is DoubleData)
+        RandomizeUniform((DoubleData)value, mt, min, max);
+      else if (value is ConstrainedDoubleData)
+        RandomizeUniform((ConstrainedDoubleData)value, mt, min, max);
+      else if (value is IntData)
+        RandomizeUniform((IntData)value, mt, min, max);
+      else if (value is ConstrainedIntData)
+        RandomizeUniform((ConstrainedIntData)value, mt, min, max);
+      else throw new ArgumentException("Can't handle type " + value.GetType().Name);
+    }
+
+      /// <summary>
+      /// Generates a new double random number.
+      /// </summary>
+      /// <param name="data">The double object which the new value is assigned to.</param>
+      /// <param name="mt">The random number generator.</param>
+      /// <param name="min">The left border of the interval in which the next random number has to lie.</param>
+      /// <param name="max">The right border (exclusive) of the interval in which the next random number
+      /// has to lie.</param>
+      public void RandomizeUniform(DoubleData data, MersenneTwister mt, double min, double max) {
+        data.Data = mt.NextDouble() * (max - min) + min;
+      }
+
+      /// <summary>
+      /// Generates a new int random number.
+      /// </summary>
+      /// <param name="data">The int object which the new value is assigned to.</param>
+      /// <param name="mt">The random number generator.</param>
+      /// <param name="min">The left border of the interval in which the next random number has to lie.</param>
+      /// <param name="max">The right border (exclusive) of the interval in which the next random number
+      /// has to lie.</param>
+      public void RandomizeUniform(IntData data, MersenneTwister mt, double min, double max) {
+        data.Data = (int)Math.Floor(mt.NextDouble() * (max - min) + min);
+      }
+
+      /// <summary>
+      /// Generates a new double random number, being restricted to some constraints.
+      /// </summary>
+      /// <exception cref="InvalidOperationException">Thrown when no valid value could be found.</exception>
+      /// <param name="data">The double object which the new value is assigned to and whose constraints
+      /// must be fulfilled.</param>
+      /// <param name="mt">The random number generator.</param>
+      /// <param name="min">The left border of the interval in which the next random number has to lie.</param>
+      /// <param name="max">The right border (exclusive) of the interval in which the next random number
+      /// has to lie.</param>
+      public void RandomizeUniform(ConstrainedDoubleData data, MersenneTwister mt, double min, double max) {
+        for(int tries = MAX_NUMBER_OF_TRIES; tries >= 0; tries--) {
+          double r = mt.NextDouble() * (max - min) + min;
+          if(IsIntegerConstrained(data)) {
+            r = Math.Floor(r);
+          }
+          if(data.TrySetData(r)) {
+            return;
+          }
+        }
+        throw new InvalidOperationException("Couldn't find a valid value");
+      }
+      /// <summary>
+      /// Generates a new int random number, being restricted to some constraints.
+      /// </summary>
+      /// <exception cref="InvalidOperationException">Thrown when no valid value could be found.</exception>
+      /// <param name="data">The int object which the new value is assigned to and whose constraints
+      /// must be fulfilled.</param>
+      /// <param name="mt">The random number generator.</param>
+      /// <param name="min">The left border of the interval in which the next random number has to lie.</param>
+      /// <param name="max">The right border (exclusive) of the interval in which the next random number
+      /// has to lie.</param>
+      public void RandomizeUniform(ConstrainedIntData data, MersenneTwister mt, double min, double max) {
+        for(int tries = MAX_NUMBER_OF_TRIES; tries >= 0; tries--) {
+          int r = (int)Math.Floor(mt.NextDouble() * (max - min) + min);
+          if(data.TrySetData(r)) {
+            return;
+          }
+        }
+        throw new InvalidOperationException("Couldn't find a valid value");
+      }
+
+      private bool IsIntegerConstrained(ConstrainedDoubleData data) {
+        foreach(IConstraint constraint in data.Constraints) {
+          if(constraint is IsIntegerConstraint) {
+            return true;
+          }
+        }
+        return false;
+      }
+    }
+}
