Random Interop Extensions.As Random Source Method
Definition
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.3.0
public static IRandomSource AsRandomSource(
this Random random
)Parameters
Return Value
IRandomSourceAn IRandomSource that delegates to random.
Usage Note
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).Remarks
This method wraps random in a Numerics.NET IRandomSource adapter for use in Numerics.NET APIs. The wrapper forwards all operations to the underlying Random instance.
No Caching:
Repeated calls may allocate new wrapper instances. Do not rely on wrapper identity or equality.
Round-tripping:
If random is a WrappedIRandom<TRng>, this method returns the original underlying random source.
State Persistence:
The returned wrapper does not support state persistence. Calling state-related members on the wrapper throws NotSupportedException.
Exceptions
| Argument | random is null. |