public static double RandomDouble(ISpecificationProperty specificationProperty) { if (specificationProperty.PropertyType != "double" && specificationProperty.PropertyType != "double?") { throw new ArgumentException("Specification Property " + specificationProperty.Name + " is not an double!"); } double randomDouble; if (specificationProperty.Minimum == null && specificationProperty.Maximum == null) { randomDouble = TemplatesHelper.RandomDouble(-100d, 100d); } else if (specificationProperty.Minimum == null) { randomDouble = TemplatesHelper.RandomDouble(-100d, (double)specificationProperty.Maximum); } else if (specificationProperty.Maximum == null) { randomDouble = TemplatesHelper.RandomDouble((double)specificationProperty.Minimum, 100d); } else { randomDouble = TemplatesHelper.RandomDouble((double)specificationProperty.Minimum, (double)specificationProperty.Maximum); } if (specificationProperty.MantissaSize != null) { randomDouble = Math.Round(randomDouble, specificationProperty.MantissaSize.Value); } return(randomDouble); }