Changeset 15973 for branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/ValueGenerator.cs
- Timestamp:
- 06/28/18 11:13:37 (6 years ago)
- Location:
- branches/2522_RefactorPluginInfrastructure
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2522_RefactorPluginInfrastructure
- Property svn:ignore
-
old new 24 24 protoc.exe 25 25 obj 26 .vs
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.Instances.DataAnalysis
- Property svn:mergeinfo changed
-
branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/ValueGenerator.cs
r12292 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 26 26 namespace HeuristicLab.Problems.Instances.DataAnalysis { 27 27 internal static class ValueGenerator { 28 private static FastRandom rand = new FastRandom();29 28 30 29 /// <summary> 31 30 /// Generates uniformly distributed values between start and end (inclusive!) 32 31 /// </summary> 32 /// <param name="seed">The seed for the random number generator</param> 33 33 /// <param name="n">Number of values to generate.</param> 34 34 /// <param name="start">The lower value (inclusive)</param> 35 35 /// <param name="end">The upper value (inclusive)</param> 36 36 /// <returns>An enumerable including n values in [start, end]</returns> 37 public static IEnumerable<double> GenerateUniformDistributedValues(int n, double start, double end) { 37 public static IEnumerable<double> GenerateUniformDistributedValues(int seed, int n, double start, double end) { 38 var rand = new FastRandom(seed); 38 39 for (int i = 0; i < n; i++) { 39 40 // we need to return a random value including end. … … 47 48 /// Generates normally distributed values sampling from N(mu, sigma) 48 49 /// </summary> 50 /// <param name="seed">The seed for the random number generator</param> 49 51 /// <param name="n">Number of values to generate.</param> 50 52 /// <param name="mu">The mu parameter of the normal distribution</param> 51 53 /// <param name="sigma">The sigma parameter of the normal distribution</param> 52 54 /// <returns>An enumerable including n values ~ N(mu, sigma)</returns> 53 public static IEnumerable<double> GenerateNormalDistributedValues(int n, double mu, double sigma) { 55 public static IEnumerable<double> GenerateNormalDistributedValues(int seed, int n, double mu, double sigma) { 56 var rand = new FastRandom(seed); 54 57 for (int i = 0; i < n; i++) 55 58 yield return NormalDistributedRandom.NextDouble(rand, mu, sigma);
Note: See TracChangeset
for help on using the changeset viewer.