mirror of
https://github.com/wanghongenpin/proxypin.git
synced 2026-03-25 06:19:46 +08:00
14 lines
361 B
Dart
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)),
|
|
));
|
|
}
|
|
}
|