Last change
on this file since 7128 was
7128,
checked in by epitzer, 13 years ago
|
#1696 Integrate fitness landscape analysis plugins from Heureka! repository.
|
File size:
494 bytes
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using HeuristicLab.Core;
|
---|
6 |
|
---|
7 | namespace HeuristicLab.Analysis.FitnessLandscape {
|
---|
8 | public static class IListExtensions {
|
---|
9 | public static void Shuffle<T>(this IList<T> list, IRandom random) {
|
---|
10 | int n = list.Count;
|
---|
11 | while (n > 1) {
|
---|
12 | n--;
|
---|
13 | int k = random.Next(n + 1);
|
---|
14 | T value = list[k];
|
---|
15 | list[k] = list[n];
|
---|
16 | list[n] = value;
|
---|
17 | }
|
---|
18 | }
|
---|
19 | }
|
---|
20 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.