Index: runtime/bin/websocket_impl.dart |
diff --git a/runtime/bin/websocket_impl.dart b/runtime/bin/websocket_impl.dart |
index 6be62008a96b76d94dec5ea1cac50a9c81bdbedc..a673c25b80b2cfc2ebda189d02db535207b878b7 100644 |
--- a/runtime/bin/websocket_impl.dart |
+++ b/runtime/bin/websocket_impl.dart |
@@ -727,6 +727,7 @@ class _WebSocketClientConnection |
} |
void _generateNonceAndHash() { |
+ Random random = new Random(); |
assert(_nonce == null); |
void intToBigEndianBytes(int value, List<int> bytes, int offset) { |
bytes[offset] = (value >> 24) & 0xFF; |
@@ -738,11 +739,11 @@ class _WebSocketClientConnection |
// Generate 16 random bytes. Use the last four bytes for the hash code. |
List<int> nonce = new List<int>(16); |
for (int i = 0; i < 4; i++) { |
- int r = (Math.random() * 0x100000000).toInt(); |
+ int r = (random.nextDouble() * 0x100000000).toInt(); |
Anders Johnsen
2012/08/22 07:37:53
Use nextInt(0x100000000)?
Mads Ager (google)
2012/08/22 13:42:41
Done.
|
intToBigEndianBytes(r, nonce, i * 4); |
} |
_nonce = _Base64._encode(nonce); |
- _hash = (Math.random() * 0x100000000).toInt(); |
+ _hash = (random.nextDouble() * 0x100000000).toInt(); |
Anders Johnsen
2012/08/22 07:37:53
Ditto.
Mads Ager (google)
2012/08/22 13:42:41
Done.
|
} |
bool _isWebSocketUpgrade(HttpClientResponse response) { |