Package dev.restate.sdk
Class RestateRandom
java.lang.Object
java.util.Random
dev.restate.sdk.RestateRandom
- All Implemented Interfaces:
Serializable
,RandomGenerator
Subclass of
Random
inherently predictable, seeded on the InvocationId
, 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.run(Serde, ThrowingSupplier)
.
You MUST NOT use this object inside a Context.run(Serde, ThrowingSupplier)
.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.random.RandomGenerator
RandomGenerator.ArbitrarilyJumpableGenerator, RandomGenerator.JumpableGenerator, RandomGenerator.LeapableGenerator, RandomGenerator.SplittableGenerator, RandomGenerator.StreamableGenerator
-
Method Summary
Methods inherited from class java.util.Random
doubles, doubles, doubles, doubles, from, ints, ints, ints, ints, longs, longs, longs, longs, nextBoolean, nextBytes, nextDouble, nextFloat, nextGaussian, nextInt, nextInt, nextLong
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.random.RandomGenerator
isDeprecated, nextDouble, nextDouble, nextExponential, nextFloat, nextFloat, nextGaussian, nextInt, nextLong, nextLong
-
Method Details
-
setSeed
public void setSeed(long seed) - Overrides:
setSeed
in classRandom
- Throws:
UnsupportedOperationException
- You cannot set the seed on RestateRandom
-
nextUUID
- Returns:
- a UUID generated using this RNG that is stable across retries and replays.
-
next
protected int next(int bits)
-