selfprivacy.org.app/lib/utils/password_generator2.dart

15 lines
333 B
Dart
Raw Normal View History

2021-02-17 14:30:02 +00:00
import 'dart:math';
const _chars =
'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890_';
Random _rnd = Random();
String getRandomString(int length) => String.fromCharCodes(
Iterable.generate(
length,
(_) => _chars.codeUnitAt(
_rnd.nextInt(_chars.length),
),
),
);