/// <summary> /// If source is not null then function creates it's clone. If not, function creates instance of the RandomValueSettings using specified default parameters. /// </summary> public static RandomValueSettings CloneOrDefault(RandomValueSettings source, double defaultMin, double defaultMax, bool randomSign = false) { if (source == null) { return(new RandomValueSettings(defaultMin, defaultMax, randomSign)); } else { return(source.DeepClone()); } }
/// <summary> /// Clones the existing configuration or creates the new configuration of the random value. /// </summary> /// <remarks> /// Checks whether the specified source configuration instance is not null and if so, creates its clone. /// If the source configuration instance is null, creates the configuration according to specified parameters. /// </remarks> /// <param name="source">The source configuration instance.</param> /// <param name="min">The min value.</param> /// <param name="max">The max value.</param> /// <param name="randomSign">Specifies whether to randomize the value sign.</param> public static RandomValueSettings CloneOrCreate(RandomValueSettings source, double min, double max, bool randomSign = false) { if (source == null) { return(new RandomValueSettings(min, max, randomSign)); } else { return((RandomValueSettings)source.DeepClone()); } }