toRandomInt method

int toRandomInt()

Returns a unique random integer from a string.

文字列から一意のランダムな整数を返します。

Implementation

int toRandomInt() {
  if (isEmpty) {
    return 0;
  }
  final seed = codeUnits.fold<int>(0, (p, e) => p + e);
  final random = Random(seed);
  return (((random.nextDouble() * 2) - 1.0) * _kMaxInt).toInt();
}