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 c774c20a02b892825be9ec1613e1086fca65e60e..68bae9ad815586c8fb94410018a6448570e5d667 100644 |
--- a/sdk/lib/_internal/js_runtime/lib/math_patch.dart |
+++ b/sdk/lib/_internal/js_runtime/lib/math_patch.dart |
@@ -79,21 +79,21 @@ class _JSRandom implements Random { |
int nextInt(int max) { |
if (max <= 0 || max > _POW2_32) { |
- throw new RangeError("max must be in range 0 < max ≤ 2^32, was $max"); |
+ throw new RangeError('max must be in range 0 < max ≤ 2^32, was $max'); |
} |
- return JS("int", "(Math.random() * #) >>> 0", max); |
+ return JS('int', '(Math.random() * #) >>> 0', max); |
} |
/** |
* Generates a positive random floating point value uniformly distributed on |
* the range from 0.0, inclusive, to 1.0, exclusive. |
*/ |
- double nextDouble() => JS("double", "Math.random()"); |
+ double nextDouble() => JS('double', 'Math.random()'); |
/** |
* Generates a random boolean value. |
*/ |
- bool nextBool() => JS("bool", "Math.random() < 0.5"); |
+ bool nextBool() => JS('bool', 'Math.random() < 0.5'); |
} |
class _Random implements Random { |
@@ -215,7 +215,7 @@ class _Random implements Random { |
int nextInt(int max) { |
if (max <= 0 || max > _POW2_32) { |
- throw new RangeError("max must be in range 0 < max ≤ 2^32, was $max"); |
+ throw new RangeError('max must be in range 0 < max ≤ 2^32, was $max'); |
} |
if ((max & (max - 1)) == 0) { |
// Fast case for powers of two. |
@@ -252,20 +252,20 @@ class _JSSecureRandom implements Random { |
final _buffer = new ByteData(8); |
_JSSecureRandom() { |
- var crypto = JS("", "self.crypto"); |
+ var crypto = JS('', 'self.crypto'); |
if (crypto != null) { |
- var getRandomValues = JS("", "#.getRandomValues", crypto); |
+ var getRandomValues = JS('', '#.getRandomValues', crypto); |
if (getRandomValues != null) { |
return; |
} |
} |
throw new UnsupportedError( |
- "No source of cryptographically secure random numbers available."); |
+ 'No source of cryptographically secure random numbers available.'); |
} |
/// Fill _buffer from [start] to `start + length` with random bytes. |
void _getRandomBytes(int start, int length) { |
- JS("void", "crypto.getRandomValues(#)", |
+ JS('void', 'crypto.getRandomValues(#)', |
_buffer.buffer.asUint8List(start, length)); |
} |
@@ -296,7 +296,7 @@ class _JSSecureRandom implements Random { |
int nextInt(int max) { |
if (max <= 0 || max > _POW2_32) { |
- throw new RangeError("max must be in range 0 < max ≤ 2^32, was $max"); |
+ throw new RangeError('max must be in range 0 < max ≤ 2^32, was $max'); |
} |
int byteCount = 1; |
if (max > 0xFF) { |