added guardian letters with chat and multiple answer functionalities
This commit is contained in:
@@ -8,3 +8,12 @@ String randomHexId({int bytes = 16}) {
|
||||
(_) => random.nextInt(256),
|
||||
).map((b) => b.toRadixString(16).padLeft(2, '0')).join();
|
||||
}
|
||||
|
||||
/// Random RFC 4122 version-4 UUID, for ids a server expects in UUID form.
|
||||
String randomUuidV4() {
|
||||
final hex = randomHexId();
|
||||
final variant = (int.parse(hex[16], radix: 16) & 0x3 | 0x8).toRadixString(16);
|
||||
return '${hex.substring(0, 8)}-${hex.substring(8, 12)}-'
|
||||
'4${hex.substring(13, 16)}-$variant${hex.substring(17, 20)}-'
|
||||
'${hex.substring(20)}';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user