PostSharp 6.9 / / Post­Sharp Documentation / API Reference / Post­Sharp.​Patterns.​Diagnostics.​Transactions.​Model Namespace / Transaction­Policy­Expression­Functions Class / Transaction­Policy­Expression­Functions Methods / Transaction­Policy­Expression­Functions.​Random Method

TransactionPolicyExpressionFunctions.Random Method

Returns true randomly, with a chance given by the threshold.

Namespace:  PostSharp.Patterns.Diagnostics.Transactions.Model
Assembly:  PostSharp.Patterns.Diagnostics.Configuration (in PostSharp.Patterns.Diagnostics.Configuration.dll) Version: 6.9.1.0 (6.9.1.0)
Syntax
C#
public static bool Random(
	double threshold
)

Parameters

threshold
Type: System.Double
Returns true with this probability. For example, if threshold is 0.54, then this method returns true with probability 54%.

Return Value

Type: Boolean
Remarks

This function is only available in the Sample expression.

See Also