Beispiel #1
0
 //Constructors
 /// <summary>
 /// Creates an initialized instance
 /// </summary>
 /// <param name="min">Min random value</param>
 /// <param name="max">Max random value</param>
 /// <param name="randomSign">Specifies whether to randomize value sign</param>
 /// <param name="distrCfg">Specific parameters of the distribution</param>
 public RandomValueSettings(double min              = -1,
                            double max              = 1,
                            bool randomSign         = false,
                            IDistrSettings distrCfg = null
                            )
 {
     Min        = min;
     Max        = max;
     RandomSign = randomSign;
     DistrCfg   = distrCfg;
     if (DistrCfg == null)
     {
         DistrType = RandomExtensions.DistributionType.Uniform;
     }
     else
     {
         Type dcType = DistrCfg.GetType();
         if (dcType == typeof(GaussianDistrSettings))
         {
             DistrType = RandomExtensions.DistributionType.Gaussian;
         }
         else if (dcType == typeof(ExponentialDistrSettings))
         {
             DistrType = RandomExtensions.DistributionType.Exponential;
         }
         else if (dcType == typeof(GammaDistrSettings))
         {
             DistrType = RandomExtensions.DistributionType.Gamma;
         }
         else
         {
             throw new Exception($"Unexpected distribution configuration");
         }
     }
     Check();
     return;
 }