Struct DiscreteChar
Represents a distribution over characters.
Implements
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Distributions
Assembly: Microsoft.ML.Probabilistic.dll
Syntax
[Quality(QualityBand.Experimental)]
[Serializable]
public struct DiscreteChar : IDistribution<char>, IDistribution, ICloneable, Diffable, SettableToUniform, HasPoint<char>, CanGetLogProb<char>, SettableTo<DiscreteChar>, SettableTo<ImmutableDiscreteChar>, SettableToProduct<DiscreteChar>, SettableToProduct<DiscreteChar, DiscreteChar>, SettableToProduct<ImmutableDiscreteChar>, SettableToProduct<ImmutableDiscreteChar, ImmutableDiscreteChar>, SettableToProduct<ImmutableDiscreteChar, DiscreteChar>, SettableToProduct<DiscreteChar, ImmutableDiscreteChar>, SettableToRatio<DiscreteChar>, SettableToRatio<DiscreteChar, DiscreteChar>, SettableToRatio<ImmutableDiscreteChar>, SettableToRatio<ImmutableDiscreteChar, ImmutableDiscreteChar>, SettableToRatio<ImmutableDiscreteChar, DiscreteChar>, SettableToRatio<DiscreteChar, ImmutableDiscreteChar>, SettableToPower<DiscreteChar>, SettableToPower<ImmutableDiscreteChar>, SettableToWeightedSumExact<DiscreteChar>, SettableToWeightedSum<DiscreteChar>, SettableToWeightedSumExact<ImmutableDiscreteChar>, SettableToWeightedSum<ImmutableDiscreteChar>, SettableToPartialUniform<DiscreteChar>, SettableToPartialUniform<ImmutableDiscreteChar>, CanGetLogAverageOf<DiscreteChar>, CanGetLogAverageOf<ImmutableDiscreteChar>, CanGetLogAverageOfPower<DiscreteChar>, CanGetLogAverageOfPower<ImmutableDiscreteChar>, CanGetAverageLog<DiscreteChar>, CanGetAverageLog<ImmutableDiscreteChar>, CanGetMode<char>, Sampleable<char>, CanEnumerateSupport<char>, IEquatable<DiscreteChar>
Constructors
DiscreteChar(ImmutableDiscreteChar)
Declaration
public DiscreteChar(ImmutableDiscreteChar wrappedDistribution)
Parameters
| Type | Name | Description |
|---|---|---|
| ImmutableDiscreteChar | wrappedDistribution |
Fields
CharRangeEndExclusive
The (exclusive) end of the character range.
Declaration
public const int CharRangeEndExclusive = 65536
Field Value
| Type | Description |
|---|---|
| Int32 |
LetterCharacterRanges
Ranges of letters (for Letter()).
Declaration
public const string LetterCharacterRanges = "AZÀÖØÞazßöøÿ"
Field Value
| Type | Description |
|---|---|
| String |
LowerCaseCharacterRanges
Ranges of lowercase characters (for Lower()).
Declaration
public const string LowerCaseCharacterRanges = "azßöøÿ"
Field Value
| Type | Description |
|---|---|
| String |
MixedCaseCharacterRanges
Ranges of mixed upper and lower case characters, which are merged for computational efficiency reasons.
Declaration
public const string MixedCaseCharacterRanges = ""
Field Value
| Type | Description |
|---|---|
| String |
Remarks
In some Unicode ranges, upper and lower characters alternate which makes it very expensive to represent just lower or just upper characters using ranges. Instead, we use a loose approximation and allow characters in such ranges to be considered either lower or upper case.
This approximation means that upper and lower case character ranges are no longer mutually exclusive.
OnlyLowerCaseCharacterRanges
Ranges of only lowercase characters, excluding the mixed range.
Declaration
public const string OnlyLowerCaseCharacterRanges = "azßöøÿ"
Field Value
| Type | Description |
|---|---|
| String |
OnlyUpperCaseCharacterRanges
Ranges of only uppercase characters, excluding the mixed range
Declaration
public const string OnlyUpperCaseCharacterRanges = "AZÀÖØÞ"
Field Value
| Type | Description |
|---|---|
| String |
UpperCaseCharacterRanges
Ranges of uppercase characters (for Upper()).
Declaration
public const string UpperCaseCharacterRanges = "AZÀÖØÞ"
Field Value
| Type | Description |
|---|---|
| String |
Properties
IsDigit
Gets a value indicating whether this distribution equals the distribution created by Digit().
Declaration
public readonly bool IsDigit { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
IsInitialized
Declaration
public readonly bool IsInitialized { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
IsLetter
Gets a value indicating whether this distribution equals the distribution created by Letter().
Declaration
public readonly bool IsLetter { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
IsLetterOrDigit
Gets a value indicating whether this distribution equals the distribution created by LetterOrDigit().
Declaration
public readonly bool IsLetterOrDigit { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
IsLower
Gets a value indicating whether this distribution equals the distribution created by Lower().
Declaration
public readonly bool IsLower { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
IsPointMass
Gets whether the distribution parameters represent a point mass.
Declaration
public readonly bool IsPointMass { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
IsUpper
Gets a value indicating whether this distribution equals the distribution created by Upper().
Declaration
public readonly bool IsUpper { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
IsWordChar
Gets a value indicating whether this distribution equals the distribution created by WordChar().
Declaration
public readonly bool IsWordChar { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
Item[Char]
Gets the probability of a given character under this distribution.
Declaration
public readonly double this[char value] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| Char | value | The character. |
Property Value
| Type | Description |
|---|---|
| Double | The probability of the character under this distribution. |
Point
Gets or sets the point mass represented by the distribution.
Declaration
public char Point { get; set; }
Property Value
| Type | Description |
|---|---|
| Char |
Ranges
Gets an array of character ranges with associated probabilities.
Declaration
public readonly ReadOnlyArray<ImmutableDiscreteChar.CharRange> Ranges { get; }
Property Value
| Type | Description |
|---|---|
| ReadOnlyArray<ImmutableDiscreteChar.CharRange> | An array of character ranges with associated probabilities. |
WrappedDistribution
Immutable snapshot of the current distribution.
Declaration
[DataMember]
public ImmutableDiscreteChar WrappedDistribution { get; }
Property Value
| Type | Description |
|---|---|
| ImmutableDiscreteChar |
Methods
Any()
Creates a uniform distribution over all characters.
Declaration
public static DiscreteChar Any()
Returns
| Type | Description |
|---|---|
| DiscreteChar | The created distribution. |
AppendRegex(StringBuilder, Boolean)
Appends a regex expression that represents this character to the supplied string builder.
Declaration
public void AppendRegex(StringBuilder stringBuilder, bool useFriendlySymbols = false)
Parameters
| Type | Name | Description |
|---|---|---|
| StringBuilder | stringBuilder | The string builder to append to |
| Boolean | useFriendlySymbols | Whether to use friendly symbols." |
AppendToString(StringBuilder)
Declaration
public void AppendToString(StringBuilder stringBuilder)
Parameters
| Type | Name | Description |
|---|---|---|
| StringBuilder | stringBuilder |
Clone()
Creates a copy of this distribution.
Declaration
public DiscreteChar Clone()
Returns
| Type | Description |
|---|---|
| DiscreteChar | The created copy. |
Complement()
Creates a distribution which is uniform over all characters that have zero probability under this distribution i.e. that are not 'in' this distribution.
Declaration
public DiscreteChar Complement()
Returns
| Type | Description |
|---|---|
| DiscreteChar | The created distribution. |
Remarks
This is useful for defining characters that are not in a particular distribution e.g. not a letter or not a word character.
Create(IEnumerable<ImmutableDiscreteChar.CharRange>)
Creates a distribution given a list of constant probability character ranges.
Declaration
[Construction(new string[]{"Ranges"})]
public static DiscreteChar Create(IEnumerable<ImmutableDiscreteChar.CharRange> ranges)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<ImmutableDiscreteChar.CharRange> | ranges | The constant-probability character ranges. |
Returns
| Type | Description |
|---|---|
| DiscreteChar | The created distribution. |
Remarks
The probabilities do not need to be normalized. The character ranges do not need to be sorted.
Digit()
Creates a uniform distribution over digits '0'..'9'.
Declaration
[Construction(UseWhen = "IsDigit")]
public static DiscreteChar Digit()
Returns
| Type | Description |
|---|---|
| DiscreteChar | The created distribution. |
EnumerateSupport()
Enumerates over the support of the distribution instance.
Declaration
public IEnumerable<char> EnumerateSupport()
Returns
| Type | Description |
|---|---|
| IEnumerable<Char> | The domain values with non-zero mass. |
Equals(DiscreteChar)
Checks if that equals to this distribution (i.e. represents the same distribution over characters).
Declaration
public bool Equals(DiscreteChar that)
Parameters
| Type | Name | Description |
|---|---|---|
| DiscreteChar | that | The object to compare this distribution with. |
Returns
| Type | Description |
|---|---|
| Boolean | true if this distribution is equal to |
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | obj |
Returns
| Type | Description |
|---|---|
| Boolean |
Overrides
FromVector(PiecewiseVector)
Creates a point character from a vector of (unnormalized) character probabilities.
Declaration
public static DiscreteChar FromVector(PiecewiseVector vector)
Parameters
| Type | Name | Description |
|---|---|---|
| PiecewiseVector | vector | The vector of unnormalized probabilities. |
Returns
| Type | Description |
|---|---|
| DiscreteChar | The created distribution. |
FromVector(Vector)
Creates a point character from a vector of (unnormalized) character probabilities.
Declaration
public static DiscreteChar FromVector(Vector vector)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | vector | The vector of unnormalized probabilities. |
Returns
| Type | Description |
|---|---|
| DiscreteChar | The created distribution. |
GetAverageLog(DiscreteChar)
The expected logarithm of that distribution under this distribution.
Declaration
public double GetAverageLog(DiscreteChar that)
Parameters
| Type | Name | Description |
|---|---|---|
| DiscreteChar | that |
Returns
| Type | Description |
|---|---|
| Double |
|
Remarks
This is also known as the cross entropy.
GetAverageLog(ImmutableDiscreteChar)
The expected logarithm of that distribution under this distribution.
Declaration
public double GetAverageLog(ImmutableDiscreteChar that)
Parameters
| Type | Name | Description |
|---|---|---|
| ImmutableDiscreteChar | that |
Returns
| Type | Description |
|---|---|
| Double |
|
Remarks
This is also known as the cross entropy.
GetHashCode()
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| Int32 |
Overrides
GetLogAverageOf(DiscreteChar)
The log-probability that two distributions would draw the same sample.
Declaration
public double GetLogAverageOf(DiscreteChar that)
Parameters
| Type | Name | Description |
|---|---|---|
| DiscreteChar | that |
Returns
| Type | Description |
|---|---|
| Double |
|
Remarks
This can be considered a type of inner product between distributions.
GetLogAverageOf(ImmutableDiscreteChar)
The log-probability that two distributions would draw the same sample.
Declaration
public double GetLogAverageOf(ImmutableDiscreteChar that)
Parameters
| Type | Name | Description |
|---|---|---|
| ImmutableDiscreteChar | that |
Returns
| Type | Description |
|---|---|
| Double |
|
Remarks
This can be considered a type of inner product between distributions.
GetLogAverageOfPower(DiscreteChar, Double)
The log-integral of one distribution times another raised to a power.
Declaration
public double GetLogAverageOfPower(DiscreteChar that, double power)
Parameters
| Type | Name | Description |
|---|---|---|
| DiscreteChar | that | |
| Double | power | The exponent |
Returns
| Type | Description |
|---|---|
| Double |
|
Remarks
This is not the same as GetLogAverageOf(that^power) because it includes the normalization constant of that.
GetLogAverageOfPower(ImmutableDiscreteChar, Double)
The log-integral of one distribution times another raised to a power.
Declaration
public double GetLogAverageOfPower(ImmutableDiscreteChar that, double power)
Parameters
| Type | Name | Description |
|---|---|---|
| ImmutableDiscreteChar | that | |
| Double | power | The exponent |
Returns
| Type | Description |
|---|---|
| Double |
|
Remarks
This is not the same as GetLogAverageOf(that^power) because it includes the normalization constant of that.
GetLogProb(Char)
Evaluate the log of the density function at the specified domain value
Declaration
public double GetLogProb(char value)
Parameters
| Type | Name | Description |
|---|---|---|
| Char | value |
Returns
| Type | Description |
|---|---|
| Double | The log density |
GetMode()
Gets the mode of this distribution.
Declaration
public char GetMode()
Returns
| Type | Description |
|---|---|
| Char | The mode. |
Remarks
This is not a property because it is not reasonable to expect that distributions would generally have their mode as a data member. Computing the mode could take a long time for some distributions.
GetProbs()
Gets a vector of character probabilities under this distribution.
Declaration
public PiecewiseVector GetProbs()
Returns
| Type | Description |
|---|---|
| PiecewiseVector | A vector of character probabilities. |
InRange(Char, Char)
Creates a uniform distribution over characters in a given range.
Declaration
public static DiscreteChar InRange(char start, char end)
Parameters
| Type | Name | Description |
|---|---|---|
| Char | start | The start of the range (inclusive). |
| Char | end | The end of the range (inclusive). |
Returns
| Type | Description |
|---|---|
| DiscreteChar | The created distribution. |
InRanges(Char[])
Creates a distribution which is uniform over values in multiple ranges specified by pairs of start and end values. These pairs are specified as adjacent values in an array whose length must therefore be even.
Declaration
public static DiscreteChar InRanges(params char[] startEndPairs)
Parameters
| Type | Name | Description |
|---|---|---|
| Char[] | startEndPairs | The array of range starts and ends. |
Returns
| Type | Description |
|---|---|
| DiscreteChar | The created distribution. |
InRanges(IEnumerable<Char>)
Creates a distribution which is uniform over values in multiple ranges specified by pairs of start and end values. These pairs are specified as adjacent values in a sequence whose length must therefore be even.
Declaration
public static DiscreteChar InRanges(IEnumerable<char> startEndPairs)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<Char> | startEndPairs | The sequence of range starts and ends. |
Returns
| Type | Description |
|---|---|
| DiscreteChar | The created distribution. |
IsPartialUniform()
Checks whether the distribution is uniform over its support.
Declaration
public bool IsPartialUniform()
Returns
| Type | Description |
|---|---|
| Boolean | True if the distribution is uniform over its support, false otherwise. |
IsUniform()
Ask whether the distribution instance is uniform
Declaration
public bool IsUniform()
Returns
| Type | Description |
|---|---|
| Boolean | True if uniform |
Letter()
Creates a uniform distribution over letters.
Declaration
[Construction(UseWhen = "IsLetter")]
public static DiscreteChar Letter()
Returns
| Type | Description |
|---|---|
| DiscreteChar | The created distribution. |
LetterOrDigit()
Creates a uniform distribution over letters and '0'..'9'.
Declaration
[Construction(UseWhen = "IsLetterOrDigit")]
public static DiscreteChar LetterOrDigit()
Returns
| Type | Description |
|---|---|
| DiscreteChar | The created distribution. |
Lower()
Creates a uniform distribution over lowercase letters.
Declaration
[Construction(UseWhen = "IsLower")]
public static DiscreteChar Lower()
Returns
| Type | Description |
|---|---|
| DiscreteChar | The created distribution. |
MaxDiff(Object)
Gets the maximum difference between the character probabilities under this distribution and a given one.
Declaration
public double MaxDiff(object that)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | that |
Returns
| Type | Description |
|---|---|
| Double | The computed maximum probability difference. |
NonWordChar()
Creates a uniform distribution over all characters except (letter, digit and '_').
Declaration
public static DiscreteChar NonWordChar()
Returns
| Type | Description |
|---|---|
| DiscreteChar | The created distribution. |
OneOf(Char[])
Creates a distribution which is uniform over the specified set of characters.
Declaration
public static DiscreteChar OneOf(params char[] chars)
Parameters
| Type | Name | Description |
|---|---|---|
| Char[] | chars | The characters. |
Returns
| Type | Description |
|---|---|
| DiscreteChar | The created distribution. |
OneOf(IEnumerable<Char>)
Creates a distribution which is uniform over the specified set of characters.
Declaration
public static DiscreteChar OneOf(IEnumerable<char> chars)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<Char> | chars | The characters. |
Returns
| Type | Description |
|---|---|
| DiscreteChar | The created distribution. |
PointMass(Char)
Creates a point mass character distribution.
Declaration
public static DiscreteChar PointMass(char point)
Parameters
| Type | Name | Description |
|---|---|---|
| Char | point | The point. |
Returns
| Type | Description |
|---|---|
| DiscreteChar | The created distribution. |
Read(Func<Int32>, Func<Double>)
Reads a discrete character.
Declaration
public static DiscreteChar Read(Func<int> readInt32, Func<double> readDouble)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<Int32> | readInt32 | |
| Func<Double> | readDouble |
Returns
| Type | Description |
|---|---|
| DiscreteChar |
Sample()
Sample the distribution
Declaration
public char Sample()
Returns
| Type | Description |
|---|---|
| Char | The sample value |
Sample(Char)
Sample the distribution and provide a place to put the result.
Declaration
public char Sample(char result)
Parameters
| Type | Name | Description |
|---|---|---|
| Char | result |
Returns
| Type | Description |
|---|---|
| Char |
SetTo(DiscreteChar)
Set the instance to have the same value as given
Declaration
public void SetTo(DiscreteChar value)
Parameters
| Type | Name | Description |
|---|---|---|
| DiscreteChar | value |
SetTo(ImmutableDiscreteChar)
Set the instance to have the same value as given
Declaration
public void SetTo(ImmutableDiscreteChar value)
Parameters
| Type | Name | Description |
|---|---|---|
| ImmutableDiscreteChar | value |
SetToPartialUniform()
Sets the distribution to be uniform over its support.
Declaration
public void SetToPartialUniform()
SetToPartialUniformOf(DiscreteChar)
Sets the distribution to be uniform over the support of a given distribution.
Declaration
public void SetToPartialUniformOf(DiscreteChar dist)
Parameters
| Type | Name | Description |
|---|---|---|
| DiscreteChar | dist |
SetToPartialUniformOf(ImmutableDiscreteChar)
Sets the distribution to be uniform over the support of a given distribution.
Declaration
public void SetToPartialUniformOf(ImmutableDiscreteChar dist)
Parameters
| Type | Name | Description |
|---|---|---|
| ImmutableDiscreteChar | dist |
SetToPower(DiscreteChar, Double)
Set this to the given value raised to the given power
Declaration
public void SetToPower(DiscreteChar value, double exponent)
Parameters
| Type | Name | Description |
|---|---|---|
| DiscreteChar | value | |
| Double | exponent |
SetToPower(ImmutableDiscreteChar, Double)
Set this to the given value raised to the given power
Declaration
public void SetToPower(ImmutableDiscreteChar value, double exponent)
Parameters
| Type | Name | Description |
|---|---|---|
| ImmutableDiscreteChar | value | |
| Double | exponent |
SetToProduct(DiscreteChar, DiscreteChar)
Set this to the product of a and b
Declaration
public void SetToProduct(DiscreteChar a, DiscreteChar b)
Parameters
| Type | Name | Description |
|---|---|---|
| DiscreteChar | a | |
| DiscreteChar | b |
SetToProduct(DiscreteChar, ImmutableDiscreteChar)
Set this to the product of a and b
Declaration
public void SetToProduct(DiscreteChar a, ImmutableDiscreteChar b)
Parameters
| Type | Name | Description |
|---|---|---|
| DiscreteChar | a | |
| ImmutableDiscreteChar | b |
SetToProduct(ImmutableDiscreteChar, DiscreteChar)
Set this to the product of a and b
Declaration
public void SetToProduct(ImmutableDiscreteChar a, DiscreteChar b)
Parameters
| Type | Name | Description |
|---|---|---|
| ImmutableDiscreteChar | a | |
| DiscreteChar | b |
SetToProduct(ImmutableDiscreteChar, ImmutableDiscreteChar)
Set this to the product of a and b
Declaration
public void SetToProduct(ImmutableDiscreteChar a, ImmutableDiscreteChar b)
Parameters
| Type | Name | Description |
|---|---|---|
| ImmutableDiscreteChar | a | |
| ImmutableDiscreteChar | b |
SetToRatio(DiscreteChar, DiscreteChar, Boolean)
Set this to the ratio of a and b
Declaration
public void SetToRatio(DiscreteChar a, DiscreteChar b, bool forceProper = false)
Parameters
| Type | Name | Description |
|---|---|---|
| DiscreteChar | a | |
| DiscreteChar | b | |
| Boolean | forceProper | If true, the result is modified to have parameters in a safe range |
SetToRatio(DiscreteChar, ImmutableDiscreteChar, Boolean)
Set this to the ratio of a and b
Declaration
public void SetToRatio(DiscreteChar a, ImmutableDiscreteChar b, bool forceProper = false)
Parameters
| Type | Name | Description |
|---|---|---|
| DiscreteChar | a | |
| ImmutableDiscreteChar | b | |
| Boolean | forceProper | If true, the result is modified to have parameters in a safe range |
SetToRatio(ImmutableDiscreteChar, DiscreteChar, Boolean)
Set this to the ratio of a and b
Declaration
public void SetToRatio(ImmutableDiscreteChar a, DiscreteChar b, bool forceProper = false)
Parameters
| Type | Name | Description |
|---|---|---|
| ImmutableDiscreteChar | a | |
| DiscreteChar | b | |
| Boolean | forceProper | If true, the result is modified to have parameters in a safe range |
SetToRatio(ImmutableDiscreteChar, ImmutableDiscreteChar, Boolean)
Set this to the ratio of a and b
Declaration
public void SetToRatio(ImmutableDiscreteChar a, ImmutableDiscreteChar b, bool forceProper = false)
Parameters
| Type | Name | Description |
|---|---|---|
| ImmutableDiscreteChar | a | |
| ImmutableDiscreteChar | b | |
| Boolean | forceProper | If true, the result is modified to have parameters in a safe range |
SetToSum(Double, DiscreteChar, Double, DiscreteChar)
Replaces the current distribution with a mixture of a given pair of distributions.
Declaration
public void SetToSum(double weight1, DiscreteChar value1, double weight2, DiscreteChar value2)
Parameters
| Type | Name | Description |
|---|---|---|
| Double | weight1 | The weight of the first distribution. |
| DiscreteChar | value1 | The first distribution. |
| Double | weight2 | The weight of the second distribution. |
| DiscreteChar | value2 | The second distribution. |
SetToSum(Double, ImmutableDiscreteChar, Double, ImmutableDiscreteChar)
Replaces the current distribution with a mixture of a given pair of distributions.
Declaration
public void SetToSum(double weight1, ImmutableDiscreteChar value1, double weight2, ImmutableDiscreteChar value2)
Parameters
| Type | Name | Description |
|---|---|---|
| Double | weight1 | The weight of the first distribution. |
| ImmutableDiscreteChar | value1 | The first distribution. |
| Double | weight2 | The weight of the second distribution. |
| ImmutableDiscreteChar | value2 | The second distribution. |
SetToUniform()
Set the distribution to be uniform
Declaration
public void SetToUniform()
ToLower(DiscreteChar)
Declaration
public static DiscreteChar ToLower(DiscreteChar unnormalizedCharDist)
Parameters
| Type | Name | Description |
|---|---|---|
| DiscreteChar | unnormalizedCharDist |
Returns
| Type | Description |
|---|---|
| DiscreteChar |
ToString()
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| String |
Overrides
Uniform()
Creates a uniform distribution over characters.
Declaration
[Construction(UseWhen = "IsUniform")]
public static DiscreteChar Uniform()
Returns
| Type | Description |
|---|---|
| DiscreteChar | The created distribution. |
UniformInRange(Char, Char)
Creates a uniform distribution over characters in a given range.
Declaration
public static DiscreteChar UniformInRange(char start, char end)
Parameters
| Type | Name | Description |
|---|---|---|
| Char | start | The start of the range (inclusive). |
| Char | end | The end of the range (inclusive). |
Returns
| Type | Description |
|---|---|
| DiscreteChar | The created distribution. |
UniformInRanges(Char[])
Creates a distribution which is uniform over values in multiple ranges specified by pairs of start and end values. These pairs are specified as adjacent values in an array whose length must therefore be even.
Declaration
public static DiscreteChar UniformInRanges(params char[] startEndPairs)
Parameters
| Type | Name | Description |
|---|---|---|
| Char[] | startEndPairs | The array of range starts and ends. |
Returns
| Type | Description |
|---|---|
| DiscreteChar | The created distribution. |
UniformInRanges(IEnumerable<Char>)
Creates a distribution which is uniform over values in multiple ranges specified by pairs of start and end values. These pairs are specified as adjacent values in a sequence whose length must therefore be even.
Declaration
public static DiscreteChar UniformInRanges(IEnumerable<char> startEndPairs)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<Char> | startEndPairs | The sequence of range starts and ends. |
Returns
| Type | Description |
|---|---|
| DiscreteChar | The created distribution. |
UniformOver(Char[])
Creates a distribution which is uniform over the specified set of characters.
Declaration
public static DiscreteChar UniformOver(params char[] chars)
Parameters
| Type | Name | Description |
|---|---|---|
| Char[] | chars | The characters. |
Returns
| Type | Description |
|---|---|
| DiscreteChar | The created distribution. |
UniformOver(IEnumerable<Char>)
Creates a distribution which is uniform over the specified set of characters.
Declaration
public static DiscreteChar UniformOver(IEnumerable<char> chars)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<Char> | chars | The characters. |
Returns
| Type | Description |
|---|---|
| DiscreteChar | The created distribution. |
Upper()
Creates a uniform distribution over uppercase letters.
Declaration
[Construction(UseWhen = "IsUpper")]
public static DiscreteChar Upper()
Returns
| Type | Description |
|---|---|
| DiscreteChar | The created distribution. |
Whitespace()
Creates a uniform distribution over whitespace characters ('\t'..'\r', ' ').
Declaration
public static DiscreteChar Whitespace()
Returns
| Type | Description |
|---|---|
| DiscreteChar | The created distribution. |
WordChar()
Creates a uniform distribution over word characters (letter, digit and '_').
Declaration
[Construction(UseWhen = "IsWordChar")]
public static DiscreteChar WordChar()
Returns
| Type | Description |
|---|---|
| DiscreteChar | The created distribution. |
Write(Action<Int32>, Action<Double>)
Writes a discrete character.
Declaration
public void Write(Action<int> writeInt32, Action<double> writeDouble)
Parameters
| Type | Name | Description |
|---|---|---|
| Action<Int32> | writeInt32 | |
| Action<Double> | writeDouble |
Explicit Interface Implementations
ICloneable.Clone()
Creates a copy of this distribution.
Declaration
object ICloneable.Clone()
Returns
| Type | Description |
|---|---|
| Object | The created copy. |