/// <include file='FactorDocs.xml' path='factor_docs/message_op_class[@name="StringOfLengthOp"]/message_doc[@name="StrAverageConditional(DiscreteChar, Discrete)"]/*'/> public static StringDistribution StrAverageConditional(DiscreteChar allowedChars, Discrete length) { Argument.CheckIfNotNull(length, "length"); Argument.CheckIfValid(allowedChars.IsPartialUniform(), "allowedChars", "The set of allowed characters must be passed as a partial uniform distribution."); double logNormalizer = allowedChars.GetLogAverageOf(allowedChars); var oneCharacter = StringAutomaton.ConstantOnElementLog(logNormalizer, allowedChars.WrappedDistribution); var manyCharacters = StringAutomaton.Repeat(oneCharacter, length.GetWorkspace()); return(StringDistribution.FromWeightFunction(manyCharacters)); }