getRandomChar method

  1. @useResult
String getRandomChar()

Returns a random character from this string.

Implementation

@useResult
String getRandomChar() {
  if (isEmpty) {
    return '';
  }

  final int index = DateTime.now().microsecondsSinceEpoch % length;

  return this[index];
}