Skip to content

Commit

Permalink
Cleanup and version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
daegalus committed Apr 6, 2023
1 parent ca2bf53 commit 06e425a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

v4.0.0-beta3-1

* Ensure that any custom RNG implementation produces Uint8Lists of length 16. (Thanks @wph44)

v4.0.0-beta3

* **[BREAKING CHANGE]** Replacing UuidUtil rng functions with RNG classes.
Expand Down
8 changes: 7 additions & 1 deletion lib/rng.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import 'dart:math';
import 'dart:typed_data';

// RNG is an abstract class that defines the interface for a random number
// generator. It is used by the UUID class to generate random numbers.
//
// It also ensures that the Uint8List returned by the RNG is of the correct
// length. Throws an [Exception] if the length is not 16.
abstract class RNG {
const RNG();

Uint8List generate() {
final uint8list = generateInternal();
if (uint8list.length != 16) {
throw Exception('The length of the Uint8list returned by the custom RNG must be 16.');
throw Exception(
'The length of the Uint8list returned by the custom RNG must be 16.');
} else {
return uint8list;
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: uuid
version: 4.0.0-beta3
version: 4.0.0-beta3-1
description: >
RFC4122 (v1, v4, v5, v6, v7, v8) UUID Generator and Parser for Dart
homepage: https://github.com/Daegalus/dart-uuid
Expand Down

0 comments on commit 06e425a

Please sign in to comment.