seed property

int get seed

Gets the current seed value.

Implementation

int get seed => _seed;
set seed (int value)

Sets a new seed value and restarts the random sequence.

Note that setting to the current seed value is not a no-op and instead will restart the current sequence.

Implementation

set seed(int value) {
  // We intentionally create a new [math.Random] object even if the seed value
  // hasn't changed.  This ensures that we always produce the same sequence of
  // random numbers after setting the seed regardless of the previous history.
  _seed = value;
  restart();
}