Package dev.restate.sdk
Class RestateRandom
- java.lang.Object
-
- java.util.Random
-
- dev.restate.sdk.RestateRandom
-
- All Implemented Interfaces:
java.io.Serializable
public class RestateRandom extends java.util.RandomSubclass ofRandominherently predictable, seeded on theInvocationId, which is not secret.This instance is useful to generate identifiers, idempotency keys, and for uniform sampling from a set of options. If a cryptographically secure value is needed, please generate that externally using
Context.sideEffect(Serde, ThrowingSupplier).You MUST NOT use this object inside a
Context.sideEffect(Serde, ThrowingSupplier).- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected intnext(int bits)java.util.UUIDnextUUID()voidsetSeed(long seed)
-
-
-
Method Detail
-
setSeed
public void setSeed(long seed)
- Overrides:
setSeedin classjava.util.Random- Throws:
java.lang.UnsupportedOperationException- You cannot set the seed on RestateRandom
-
nextUUID
public java.util.UUID nextUUID()
- Returns:
- a UUID generated using this RNG.
-
next
protected int next(int bits)
- Overrides:
nextin classjava.util.Random
-
-