Class Random
- Namespace
- Antithesis.SDK
- Assembly
- Antithesis.SDK.dll
The Random class sources entropy directly from the Antithesis platform when executing within Antithesis, and from System.Random otherwise. For a System.Random-compatible adapter, see AntithesisRandom.
public static class Random
- Inheritance
-
Random
- Inherited Members
Methods
GetRandom()
Returns a raw 64-bit value chosen by Antithesis. You should use this value immediately, rather than storing it for later: if the simulation branches after the value is received, every branch sees the same value, which defeats the purpose of branching. For the same reason, do not use it to seed a pseudo-random number generator.
public static ulong GetRandom()
Returns
RandomChoice<T>(IReadOnlyList<T>)
Returns a randomly chosen item from a list of options. You should use this value
immediately rather than storing it, for the reasons described on GetRandom().
This method is not purely for convenience: signaling to the Antithesis platform that you
intend to use a random value in a structured way enables it to provide more interesting
choices over time.
public static T RandomChoice<T>(IReadOnlyList<T> items)
Parameters
itemsIReadOnlyList<T>
Returns
- T
Type Parameters
T