Skip to content

RegSeed Constructor

janzsch edited this page Nov 14, 2018 · 2 revisions

Create new instances of the Regseed-class.

Overloads

RegSeed(Random, IParserAlphabet) This constructor allows you to pass a custom Random instance or a custom parser alphabet defining all characters allowed in a regex pattern. This constructor requires loading the regex pattern via the TryLoadRegexPattern method.
RegSeed(string, Random, IParserAlphabet) Works similar to the latter constructor only that the regex pattern will be loaded instantly.
RegSeed(IRandomGenerator, IParserAlphabet) Instead of relying on the standard Microsoft random generator, you can provide your own implementation for generating random integers.

RegSeed(Random, IParserAlphabet)

    public RegSeed(Random random = null, IParserAlphabet parserAlphabet = null);

This constructor allows you to pass a custom Random instance or a custom parser alphabet defining all characters allowed in a regex pattern. This constructor requires loading the regex pattern via the TryLoadRegexPattern method.

If no parser alphabet is specified, the [DefaultAlphabet] is used.

RegSeed(string, Random, IParserAlphabet)

    public RegSeed(stringregexPattern, Random random = null, IParserAlphabet parserAlphabet = null);

Works similar to the first constructor only that the regex pattern will be loaded instantly. Use this constructor if you can assure that your regex pattern is valid with respect to the supported BNF.

Exception

RegSeed
When the provided regex pattern is invalid.

Remark

If you cannot guarantee that the regex pattern is well-formed you might consider to load the regex pattern via the [TryLoadPattern] method.

RegSeed(IRandomGenerator, IParserAlphabet)

    public RegSeed(IRandomGenerator random, IParserAlphabet parserAlphabet = null);

Instead of relying on the standard Microsoft random generator, you can provide your own implementation for generating random integers. You might use this constructor if you want to employ RegSeed for password generation and don't want to rely on pseudo random number generation.


Previous
Next