public override object Generate(ColumnModel model) { if (model is not IntegerRangeModel specModel) { throw new ApplicationException("Mismatch in model " + model.ColumnDefinitionType + " inside generator " + GetType().Name); } var result = UtilRandom.NextInteger(specModel.Min, specModel.Max, _rnd); return(result); }
public override object Generate(ColumnModel model) { if (model is not RandomCharsModel specModel) { throw new ApplicationException("Mismatch in model " + model.ColumnDefinitionType + " inside generator " + GetType().Name); } var resultLength = UtilRandom.NextInteger(specModel.MinLength, specModel.MaxLength, _rnd); var sb = new StringBuilder(); for (var i = 0; i < resultLength; i++) { var c = UtilRandom.GetCharFromString(specModel.AllowedChars, _rnd); sb.Append(c); } return(sb.ToString()); }