StdRandom class
A deterministic, predictable C++ style pseudo-random number generator.
Mimics C++ <random> library utilities by providing a stateful generator
that can be seeded (seed()), forced to discard values (flush()), and
natively constrained within specific integer boundaries (range()).
Constructors
Properties
- currentSeed → int?
-
Returns the current seed, if one was explicitly bound.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
flush(
[int count = 1]) → void -
Flushes (advances and discards) the next
countstates dynamically. -
next(
) → int -
Generates the next random integer from
0to2^32 - 1. -
nextBool(
) → bool - Generates a random boolean explicitly modeling a coin-flip.
-
nextDouble(
) → double - Generates a strictly bounded random double mathematically between 0.0 and 1.0.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
range(
int min, int max) → int -
Generates a strictly bounded random integer between
min(inclusive) andmax(exclusive). -
seed(
[int? newSeed]) → void - Re-seeds the internal generator precisely.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
globalNext(
) → int -
A statically global, easily accessible random generator cleanly replicating
global
rand()usage without needing explicit instance allocations. -
globalRange(
int min, int max) → int - Statically grabs a globally bounded uniform random integer instantly.
-
globalSeed(
int explicitSeed) → void -
Statically reseeds the globally shared
StdRandominstance dynamically.