RandomExtensionsNextTimeSpan Method
Returns a random
TimeSpan that is between the specified range.
Namespace: KGySoft.CoreLibrariesAssembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 7.2.0
public static TimeSpan NextTimeSpan(
this Random random,
TimeSpan? minValue = null,
TimeSpan? maxValue = null
)
<ExtensionAttribute>
Public Shared Function NextTimeSpan (
random As Random,
Optional minValue As TimeSpan? = Nothing,
Optional maxValue As TimeSpan? = Nothing
) As TimeSpan
public:
[ExtensionAttribute]
static TimeSpan NextTimeSpan(
Random^ random,
Nullable<TimeSpan> minValue = nullptr,
Nullable<TimeSpan> maxValue = nullptr
)
[<ExtensionAttribute>]
static member NextTimeSpan :
random : Random *
?minValue : Nullable<TimeSpan> *
?maxValue : Nullable<TimeSpan>
(* Defaults:
let _minValue = defaultArg minValue null
let _maxValue = defaultArg maxValue null
*)
-> TimeSpan
- random Random
- The Random instance to use.
- minValue NullableTimeSpan (Optional)
- The inclusive lower bound of the random TimeSpan returned or to use TimeSpan.MinValue. This parameter is optional.
Default value: . - maxValue NullableTimeSpan (Optional)
- The inclusive upper bound of the random TimeSpan returned or to use TimeSpan.MaxValue. This parameter is optional.
Default value: .
TimeSpanA
TimeSpan value that is in the specified range.In Visual Basic and C#, you can call this method as an instance method on any object of type
Random. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).