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

Unified Diff: sdk/lib/_internal/js_runtime/lib/math_patch.dart

Issue 1398453004: Add a 'secure' constructor to Random in dart:math returning a cryptographically (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: address review comments 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
Index: sdk/lib/_internal/js_runtime/lib/math_patch.dart
diff --git a/sdk/lib/_internal/js_runtime/lib/math_patch.dart b/sdk/lib/_internal/js_runtime/lib/math_patch.dart
index 34476f24d8a78c21d3e4f119810c6c1226925a96..1cf3be29548c041c1748eef65970b430884804d5 100644
--- a/sdk/lib/_internal/js_runtime/lib/math_patch.dart
+++ b/sdk/lib/_internal/js_runtime/lib/math_patch.dart
@@ -60,6 +60,12 @@ class Random {
@patch
factory Random([int seed]) =>
(seed == null) ? const _JSRandom() : new _Random(seed);
+
+ @patch
+ factory Random.secure() {
+ throw new UnsupportedError(
+ "No source of cryptographically secure random numbers available.");
+ }
}
class _JSRandom implements Random {

Powered by Google App Engine
This is Rietveld 408576698