private static IGen <char> CreateGen(Gen.CharType charType) { if (charType <= 0 || charType > Gen.CharType.All) { return(Gen.Advanced.Error <char>(nameof(CharGen), "'charType' was not a valid flag value")); } var chars = CharacterSetsByFlag .Aggregate( Enumerable.Empty <char>(), (acc, curr) => charType.HasFlag(curr.Key) ? acc.Concat(curr.Value) : acc) .ToList(); return(Gen.Int32().Between(0, chars.Count - 1).Select(i => chars[i])); }
public record FromCharType(Gen.CharType CharType) : StringGenCharConfig;
public CharGen(Gen.CharType charType) { _charType = charType; }