FakeRandom class
A fake Random implementation that always produces a given sequence of values. It should only be used in tests.
Why prefer a FakeRandom over a seeded Random?
A FakeRandom
avoids depending on implementation details. A seeded Random
is implicitly dependent on the underlying
PRNG algorithm. The generated values may change if the algorithm changes. Furthermore, reverse-engineering a seed is
cumbersome.
Constructors
-
FakeRandom({Iterable<
int> ints = const [], Iterable<double> doubles = const [], Iterable<bool> bools = const []}) -
Creates a FakeRandom with the
Iterable
s used by the various function to produce values.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
nextBool(
) → bool -
Returns the next boolean in the iterable.
override
-
nextDouble(
) → double -
Returns the next double in the iterable.
override
-
nextInt(
int max) → int -
Returns the next integer in the iterable.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited