Method MutateWord
MutateWord(Word, int, IWordAlphabet, IRandom)
Mutates a word to ensure a specific edit distance. Can add, remove, and mutate letters
public static Word MutateWord(Word word, int minEditDistance, IWordAlphabet alphabet, IRandom random)Parameters
- wordWord
- The word to mutate 
- minEditDistanceint
- The minimum edit distance to ensure 
- alphabetIWordAlphabet
- The alphabet we're operating with 
- randomIRandom
- The random generator to use. 
Returns
- Word
- The mutated word 
Remarks
While it is valid to specify an edit distance higher than
the length of the word, this is not recommended. It is entirely
possible for the algorithm to take a long time to complete, or to
never terminate at all, if this value is too high. A sane range
would keep the value between 2 and word.Length
Exceptions
- ArgumentNullException
- alphabetor- wordis null
MutateWord(Word, int, int, IWordAlphabet, IRandom)
Mutates a word to ensure a specific edit distance. Can add, remove, and mutate letters
public static Word MutateWord(Word word, int minEditDistance, int minWordLength, IWordAlphabet alphabet, IRandom random)Parameters
- wordWord
- The word to mutate 
- minEditDistanceint
- The minimum edit distance to ensure 
- minWordLengthint
- A minimum word length to maintain. The mutation will never remove more characters than this 
- alphabetIWordAlphabet
- The alphabet we're operating with 
- randomIRandom
- The random generator to use. 
Returns
- Word
- The mutated word 
Remarks
While it is valid to specify an edit distance higher than
the length of the word, this is not recommended. It is entirely
possible for the algorithm to take a long time to complete, or to
never terminate at all, if this value is too high. A sane range
would keep the value between 2 and word.Length
Exceptions
- ArgumentNullException
- alphabetor- wordis null
MutateWord(Word, IWordDictionary, IRandom)
Mutates a word to ensure a that no substrings are valid words
public static Word MutateWord(Word word, IWordDictionary dictionary, IRandom random)Parameters
- wordWord
- The word to mutate 
- dictionaryIWordDictionary
- The dictionary to use to look for subwords 
- randomIRandom
- The random generator to use. 
Returns
- Word
- The mutated word 
Remarks
In the event that the source word already contains no substrings, no mutation operations will be performed and the source word will be returned as-is
Exceptions
- ArgumentNullException
- dictionaryor- wordis null
MutateWord(Word, int, IWordDictionary, IRandom)
Mutates a word to ensure a that no substrings are valid words
public static Word MutateWord(Word word, int minWordLength, IWordDictionary dictionary, IRandom random)Parameters
- wordWord
- The word to mutate 
- minWordLengthint
- A minimum word length to maintain. The mutation will never remove more characters than this 
- dictionaryIWordDictionary
- The dictionary to use to look for subwords 
- randomIRandom
- The random generator to use. 
Returns
- Word
- The mutated word 
Remarks
In the event that the source word already contains no substrings, no mutation operations will be performed and the source word will be returned as-is
Exceptions
- ArgumentNullException
- dictionaryor- wordis null