Index: branches/gteufl/HeuristicLab.Random/3.3/HeuristicLab.Random-3.3.csproj
===================================================================
--- branches/gteufl/HeuristicLab.Random/3.3/HeuristicLab.Random-3.3.csproj	(revision 10225)
+++ branches/gteufl/HeuristicLab.Random/3.3/HeuristicLab.Random-3.3.csproj	(revision 12969)
@@ -18,5 +18,5 @@
     <UpgradeBackupLocation>
     </UpgradeBackupLocation>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <TargetFrameworkProfile>
     </TargetFrameworkProfile>
@@ -48,4 +48,5 @@
     </DocumentationFile>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
@@ -60,4 +61,5 @@
     <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
@@ -69,4 +71,5 @@
     <ErrorReport>prompt</ErrorReport>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
@@ -80,4 +83,5 @@
     <ErrorReport>prompt</ErrorReport>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
@@ -89,4 +93,5 @@
     <ErrorReport>prompt</ErrorReport>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
@@ -100,4 +105,5 @@
     <ErrorReport>prompt</ErrorReport>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <ItemGroup>
@@ -112,4 +118,5 @@
   <ItemGroup>
     <None Include="Plugin.cs.frame" />
+    <Compile Include="ListExtensions.cs" />
     <Compile Include="UniformDistributedRandom.cs" />
     <Compile Include="FastRandom.cs" />
Index: branches/gteufl/HeuristicLab.Random/3.3/ListExtensions.cs
===================================================================
--- branches/gteufl/HeuristicLab.Random/3.3/ListExtensions.cs	(revision 12969)
+++ branches/gteufl/HeuristicLab.Random/3.3/ListExtensions.cs	(revision 12969)
@@ -0,0 +1,60 @@
+﻿#region License Information
+
+/* HeuristicLab
+ * Copyright (C) 2002-2015 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.Collections.Generic;
+using HeuristicLab.Core;
+
+namespace HeuristicLab.Random {
+  public static class ListExtensions {
+    public static IList<T> Swap<T>(this IList<T> list, int indexA, int indexB) {
+      T tmp = list[indexA];
+      list[indexA] = list[indexB];
+      list[indexB] = tmp;
+      return list;
+    }
+
+    public static IList<T> ShuffleInPlace<T>(this IList<T> list, IRandom random) {
+      return list.ShuffleInPlace(random, 0, list.Count - 1);
+    }
+    public static IList<T> ShuffleInPlace<T>(this IList<T> list, IRandom random, int maxIndex) {
+      return list.ShuffleInPlace(random, 0, maxIndex);
+    }
+    public static IList<T> ShuffleInPlace<T>(this IList<T> list, IRandom random, int minIndex, int maxIndex) {
+      for (int i = maxIndex; i > minIndex; i--) {
+        int swapIndex = random.Next(minIndex, i + 1);
+        list.Swap(i, swapIndex);
+      }
+      return list;
+    }
+
+    public static IEnumerable<T> ShuffleList<T>(this IList<T> source, IRandom random) {
+      for (int i = source.Count - 1; i > 0; i--) {
+        // Swap element "i" with a random earlier element (including itself)
+        int swapIndex = random.Next(i + 1);
+        source.Swap(i, swapIndex);
+        yield return source[i];
+      }
+      yield return source[0];
+    }
+  }
+}
Index: branches/gteufl/HeuristicLab.Random/3.3/MersenneTwister.cs
===================================================================
--- branches/gteufl/HeuristicLab.Random/3.3/MersenneTwister.cs	(revision 10225)
+++ branches/gteufl/HeuristicLab.Random/3.3/MersenneTwister.cs	(revision 12969)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: branches/gteufl/HeuristicLab.Random/3.3/NormalDistributedRandom.cs
===================================================================
--- branches/gteufl/HeuristicLab.Random/3.3/NormalDistributedRandom.cs	(revision 10225)
+++ branches/gteufl/HeuristicLab.Random/3.3/NormalDistributedRandom.cs	(revision 12969)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: branches/gteufl/HeuristicLab.Random/3.3/NormalRandomizer.cs
===================================================================
--- branches/gteufl/HeuristicLab.Random/3.3/NormalRandomizer.cs	(revision 10225)
+++ branches/gteufl/HeuristicLab.Random/3.3/NormalRandomizer.cs	(revision 12969)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: branches/gteufl/HeuristicLab.Random/3.3/Plugin.cs.frame
===================================================================
--- branches/gteufl/HeuristicLab.Random/3.3/Plugin.cs.frame	(revision 10225)
+++ branches/gteufl/HeuristicLab.Random/3.3/Plugin.cs.frame	(revision 12969)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -26,5 +26,5 @@
   /// Plugin class for HeuristicLab.Random plugin.
   /// </summary>
-  [Plugin("HeuristicLab.Random", "3.3.9.$WCREV$")]
+  [Plugin("HeuristicLab.Random", "3.3.12.$WCREV$")]
   [PluginFile("HeuristicLab.Random-3.3.dll", PluginFileType.Assembly)]
   [PluginDependency("HeuristicLab.Collections", "3.3")]
Index: branches/gteufl/HeuristicLab.Random/3.3/Properties/AssemblyInfo.cs.frame
===================================================================
--- branches/gteufl/HeuristicLab.Random/3.3/Properties/AssemblyInfo.cs.frame	(revision 10225)
+++ branches/gteufl/HeuristicLab.Random/3.3/Properties/AssemblyInfo.cs.frame	(revision 12969)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -32,5 +32,5 @@
 [assembly: AssemblyCompany("")]
 [assembly: AssemblyProduct("HeuristicLab")]
-[assembly: AssemblyCopyright("(c) 2002-2013 HEAL")]
+[assembly: AssemblyCopyright("(c) 2002-2015 HEAL")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
@@ -54,3 +54,3 @@
 // by using the '*' as shown below:
 [assembly: AssemblyVersion("3.3.0.0")]
-[assembly: AssemblyFileVersion("3.3.9.$WCREV$")]
+[assembly: AssemblyFileVersion("3.3.12.$WCREV$")]
Index: branches/gteufl/HeuristicLab.Random/3.3/RandomCreator.cs
===================================================================
--- branches/gteufl/HeuristicLab.Random/3.3/RandomCreator.cs	(revision 10225)
+++ branches/gteufl/HeuristicLab.Random/3.3/RandomCreator.cs	(revision 12969)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: branches/gteufl/HeuristicLab.Random/3.3/RandomEnumerable.cs
===================================================================
--- branches/gteufl/HeuristicLab.Random/3.3/RandomEnumerable.cs	(revision 10225)
+++ branches/gteufl/HeuristicLab.Random/3.3/RandomEnumerable.cs	(revision 12969)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -36,5 +36,5 @@
 
     //algorithm taken from progamming pearls page 127
-    //IMPORTANT because IEnumerables with yield are used the seed must best be specified to return always 
+    //IMPORTANT because IEnumerables with yield are used the seed must be specified to return always 
     //the same sequence of numbers without caching the values.
     public static IEnumerable<int> SampleRandomNumbers(int seed, int start, int end, int count) {
@@ -166,4 +166,6 @@
     /// 
     /// The method internally holds two arrays: One that is the sequence itself and another one for the values.
+    /// 
+    /// The method does not check if the number of elements in source and weights are the same.
     /// </remarks>
     /// <typeparam name="T">The type of the items to be selected.</typeparam>
@@ -173,6 +175,6 @@
     /// <param name="weights">The weight values for the items.</param>
     /// <param name="windowing">Whether to scale the proportional values or not.</param>
-    /// <param name="maximization">Determines whether to choose proportionally (true) or inverse-proportionally (false).</param>
-    /// <returns>A sequence of selected items.</returns>
+    /// <param name="inverseProportional">Determines whether to choose proportionally (true) or inverse-proportionally (false).</param>
+    /// <returns>A sequence of selected items. Might actually be shorter than <paramref name="count"/> elements if source has less than <paramref name="count"/> elements.</returns>
     public static IEnumerable<T> SampleProportionalWithoutRepetition<T>(this IEnumerable<T> source, IRandom random, int count, IEnumerable<double> weights, bool windowing = true, bool inverseProportional = false) {
       return source.SampleProportionalWithoutRepetition(random, weights, windowing, inverseProportional).Take(count);
@@ -181,5 +183,5 @@
     private static IEnumerable<T> SampleProportional<T>(this IEnumerable<T> source, IRandom random, IEnumerable<double> weights, bool windowing, bool inverseProportional) {
       var sourceArray = source.ToArray();
-      var valueArray = PrepareProportional<T>(sourceArray, weights, windowing, inverseProportional);
+      var valueArray = PrepareProportional(weights, windowing, inverseProportional);
       double total = valueArray.Sum();
 
@@ -193,34 +195,31 @@
     }
     private static IEnumerable<T> SampleProportionalWithoutRepetition<T>(this IEnumerable<T> source, IRandom random, IEnumerable<double> weights, bool windowing, bool inverseProportional) {
-      var sourceArray = source.ToArray();
-      var valueArray = PrepareProportional<T>(sourceArray, weights, windowing, inverseProportional);
+      var valueArray = PrepareProportional(weights, windowing, inverseProportional);
+      var list = new LinkedList<Tuple<T, double>>(source.Zip(valueArray, Tuple.Create));
       double total = valueArray.Sum();
 
-      HashSet<int> chosenIndices = new HashSet<int>();
-      while (chosenIndices.Count < sourceArray.Length) {
-        int index = 0;
-        double ball = valueArray[index], sum = random.NextDouble() * total;
+      while (list.Count > 0) {
+        var cur = list.First;
+        double ball = cur.Value.Item2, sum = random.NextDouble() * total; // assert: sum < total. When there is only one item remaining: sum < ball
         while (ball < sum) {
-          index++;
-          if (!chosenIndices.Contains(index))
-            ball += valueArray[++index];
-        }
-        yield return sourceArray[index];
-        chosenIndices.Add(index);
-        total -= valueArray[index];
-      }
-    }
-    private static double[] PrepareProportional<T>(IList<T> sourceArray, IEnumerable<double> weights, bool windowing, bool inverseProportional) {
+          cur = cur.Next;
+          ball += cur.Value.Item2;
+        }
+        yield return cur.Value.Item1;
+        list.Remove(cur);
+        total -= cur.Value.Item2;
+      }
+    }
+
+    private static double[] PrepareProportional(IEnumerable<double> weights, bool windowing, bool inverseProportional) {
       double maxValue = double.MinValue, minValue = double.MaxValue;
-      double[] valueArray = new double[sourceArray.Count];
-
-      var weightsEnum = weights.GetEnumerator();
-      for (int i = 0; i < sourceArray.Count && weightsEnum.MoveNext(); i++) {
-        valueArray[i] = weightsEnum.Current;
+      double[] valueArray = weights.ToArray();
+
+      for (int i = 0; i < valueArray.Length; i++) {
         if (valueArray[i] > maxValue) maxValue = valueArray[i];
         if (valueArray[i] < minValue) minValue = valueArray[i];
       }
       if (minValue == maxValue) {  // all values are equal
-        for (int i = 0; i < sourceArray.Count; i++) {
+        for (int i = 0; i < valueArray.Length; i++) {
           valueArray[i] = 1.0;
         }
@@ -274,2 +273,3 @@
   }
 }
+
Index: branches/gteufl/HeuristicLab.Random/3.3/UniformDistributedRandom.cs
===================================================================
--- branches/gteufl/HeuristicLab.Random/3.3/UniformDistributedRandom.cs	(revision 10225)
+++ branches/gteufl/HeuristicLab.Random/3.3/UniformDistributedRandom.cs	(revision 12969)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: branches/gteufl/HeuristicLab.Random/3.3/UniformRandomizer.cs
===================================================================
--- branches/gteufl/HeuristicLab.Random/3.3/UniformRandomizer.cs	(revision 10225)
+++ branches/gteufl/HeuristicLab.Random/3.3/UniformRandomizer.cs	(revision 12969)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
