random method

T random({
  1. required T onNotFound(),
})

sas sas

Implementation

T random({
  required T Function() onNotFound,
}) {
  try {
    return this[Random().nextInt(length)];
  } catch (e) {
    return onNotFound();
  }
}