Files
proxypin/lib/network/util/random.dart
2024-09-27 11:08:37 +08:00

14 lines
361 B
Dart

import 'dart:math';
class RandomUtil {
static const _characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
static String randomString(int length) {
Random random = Random();
return String.fromCharCodes(Iterable.generate(
length,
(_) => _characters.codeUnitAt(random.nextInt(_characters.length)),
));
}
}