mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2024-11-18 14:49:15 +00:00
15 lines
333 B
Dart
15 lines
333 B
Dart
|
import 'dart:math';
|
||
|
|
||
|
const _chars =
|
||
|
'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890_';
|
||
|
Random _rnd = Random();
|
||
|
|
||
|
String getRandomString(int length) => String.fromCharCodes(
|
||
|
Iterable.generate(
|
||
|
length,
|
||
|
(_) => _chars.codeUnitAt(
|
||
|
_rnd.nextInt(_chars.length),
|
||
|
),
|
||
|
),
|
||
|
);
|