16 lines
440 B
Dart
16 lines
440 B
Dart
import 'dart:math';
|
|
|
|
class PasswordGenerator {
|
|
static const String _readableChars = 'ABCDEFGHJKLMNPQRSTUVWXYZ23456789';
|
|
static final Random _random = Random();
|
|
|
|
static String generateReadablePassword({int length = 6}) {
|
|
StringBuffer password = StringBuffer();
|
|
|
|
for (int i = 0; i < length; i++) {
|
|
password.write(_readableChars[_random.nextInt(_readableChars.length)]);
|
|
}
|
|
|
|
return password.toString();
|
|
}
|
|
} |