mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2024-11-08 01:43:13 +00:00
15 lines
349 B
Dart
15 lines
349 B
Dart
import 'dart:math';
|
|
|
|
const _chars =
|
|
'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890_';
|
|
Random _rnd = Random();
|
|
|
|
String getRandomString(int length, [chars = _chars]) => String.fromCharCodes(
|
|
Iterable.generate(
|
|
length,
|
|
(_) => chars.codeUnitAt(
|
|
_rnd.nextInt(chars.length),
|
|
),
|
|
),
|
|
);
|