Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(686)

Unified Diff: usage/lib/src/uuid.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « usage/lib/src/usage_impl_io.dart ('k') | usage/lib/usage.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: usage/lib/src/uuid.dart
diff --git a/usage/lib/src/uuid.dart b/usage/lib/src/uuid.dart
deleted file mode 100644
index 66e99acafb0f0a242b75899f0597e39789aad022..0000000000000000000000000000000000000000
--- a/usage/lib/src/uuid.dart
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
-// 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 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
- * http://en.wikipedia.org/wiki/Universally_unique_identifier.
- */
-class Uuid {
- 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.
- */
- 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)}-'
- '${_bitsDigits(16, 4)}-'
- '4${_bitsDigits(12, 3)}-'
- '${_printDigits(special, 1)}${_bitsDigits(12, 3)}-'
- '${_bitsDigits(16, 4)}${_bitsDigits(16, 4)}${_bitsDigits(16, 4)}';
- }
-
- String _bitsDigits(int bitCount, int digitCount) =>
- _printDigits(_generateBits(bitCount), digitCount);
-
- int _generateBits(int bitCount) => _random.nextInt(1 << bitCount);
-
- String _printDigits(int value, int count) =>
- value.toRadixString(16).padLeft(count, '0');
-}
« no previous file with comments | « usage/lib/src/usage_impl_io.dart ('k') | usage/lib/usage.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698