| Index: packages/usage/lib/src/uuid.dart
|
| diff --git a/packages/usage/lib/uuid/uuid.dart b/packages/usage/lib/src/uuid.dart
|
| similarity index 58%
|
| rename from packages/usage/lib/uuid/uuid.dart
|
| rename to packages/usage/lib/src/uuid.dart
|
| index eaafeb2f1f742683d4dc7df8fcaa87002845a3ec..66e99acafb0f0a242b75899f0597e39789aad022 100644
|
| --- a/packages/usage/lib/uuid/uuid.dart
|
| +++ b/packages/usage/lib/src/uuid.dart
|
| @@ -2,30 +2,36 @@
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| -/// A UUID generator library.
|
| -library uuid;
|
| +/**
|
| + * A UUID generator library.
|
| + */
|
| +library usage.uuid;
|
|
|
| import 'dart:math' show Random;
|
|
|
| -/// A UUID generator.
|
| -///
|
| -/// This will generate unique IDs in the format:
|
| -///
|
| -/// f47ac10b-58cc-4372-a567-0e02b2c3d479
|
| -///
|
| -/// The generated uuids are 128 bit numbers encoded in a specific string format.
|
| -/// For more information, see
|
| -/// [en.wikipedia.org/wiki/Universally_unique_identifier](http://en.wikipedia.org/wiki/Universally_unique_identifier).
|
| +/**
|
| + * A UUID generator. This will generate unique IDs in the format:
|
| + *
|
| + * f47ac10b-58cc-4372-a567-0e02b2c3d479
|
| + *
|
| + * The generated uuids are 128 bit numbers encoded in a specific string format.
|
| + *
|
| + * For more information, see
|
| + * http://en.wikipedia.org/wiki/Universally_unique_identifier.
|
| + */
|
| class Uuid {
|
| - final Random _random = new Random();
|
| + Random _random = new Random();
|
|
|
| - /// Generate a version 4 (random) uuid. This is a uuid scheme that only uses
|
| - /// random numbers as the source of the generated uuid.
|
| + /**
|
| + * Generate a version 4 (random) uuid. This is a uuid scheme that only uses
|
| + * random numbers as the source of the generated uuid.
|
| + */
|
| String generateV4() {
|
| // Generate xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx / 8-4-4-4-12.
|
| int special = 8 + _random.nextInt(4);
|
|
|
| - return '${_bitsDigits(16, 4)}${_bitsDigits(16, 4)}-'
|
| + return
|
| + '${_bitsDigits(16, 4)}${_bitsDigits(16, 4)}-'
|
| '${_bitsDigits(16, 4)}-'
|
| '4${_bitsDigits(12, 3)}-'
|
| '${_printDigits(special, 1)}${_bitsDigits(12, 3)}-'
|
|
|