Changeset 4244 for branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis
- Timestamp:
- 08/17/10 16:39:11 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/RandomEnumerable.cs
r4112 r4244 27 27 public class RandomEnumerable { 28 28 public static IEnumerable<int> SampleRandomNumbers(int maxElement, int count) { 29 return SampleRandomNumbers( ((uint)DateTime.Now.Ticks), 0, maxElement, count);29 return SampleRandomNumbers(Environment.TickCount, 0, maxElement, count); 30 30 } 31 31 32 32 public static IEnumerable<int> SampleRandomNumbers(int start, int end, int count) { 33 return SampleRandomNumbers(((uint)DateTime.Now.Ticks), start, end, count); 34 } 35 36 public static IEnumerable<int> SampleRandomNumbers(uint seed, int maxElement, int count) { 37 return SampleRandomNumbers(seed, 0, maxElement, count); 33 return SampleRandomNumbers(Environment.TickCount, start, end, count); 38 34 } 39 35 … … 41 37 //IMPORTANT because IEnumerables with yield are used the seed must best be specified to return always 42 38 //the same sequence of numbers without caching the values. 43 public static IEnumerable<int> SampleRandomNumbers( uint seed, int start, int end, int count) {39 public static IEnumerable<int> SampleRandomNumbers(int seed, int start, int end, int count) { 44 40 int remaining = end - start; 45 var mt = new MersenneTwister(seed);41 var mt = new FastRandom(seed); 46 42 for (int i = start; i < end && count > 0; i++) { 47 43 double probability = mt.NextDouble();
Note: See TracChangeset
for help on using the changeset viewer.