selfprivacy.org.app/lib/utils/password_generator2.dart
2021-03-30 19:38:40 +02:00

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),
),
),
);