Rng class

Constructors

Rng(int seed)

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

item<T>(List<T> items) → T
Return a random item from the list of items
next<T extends num>(T max) → T
Get a random number between 0 inclusive and max exclusive
nextBool() bool
Get a random boolean value
nextDouble(double max) double
Get a random floating point number between 0.0 inclusive and max exclusive
nextInt(int max) int
Get a random integer between 0 inclusive and max exclusive
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
oneIn(int value) bool
Returns true one over value percent of the time
percent(int chance) bool
Returns true chance percent of the time
rand() double
Get a traditional random number, from 0.0 inclusive to 1.0 exclusive
range(int minOrMax, [int? max]) int
Get a random integer between 0 (inclusive) and minOrMax (exclusive), or between minOrMax (inclusive) and max (exclusive) if max is given.
rangeInclusive(int minOrMax, [int? max]) int
Get a random integer between 0 (inclusive) and minOrMax (inclusive), or between minOrMax (inclusive) and max (inclusive) if max is given.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited