Chromium Code Reviews| Index: runtime/lib/math_patch.dart |
| =================================================================== |
| --- runtime/lib/math_patch.dart (revision 33702) |
| +++ runtime/lib/math_patch.dart (working copy) |
| @@ -154,13 +154,11 @@ |
| static const _A = 0xffffda61; |
| // Use a singleton Random object to get a new seed if no seed was passed. |
| - static var _prng = null; |
| + static var _prng = new Random(_initialSeed()); |
|
siva
2014/03/17 17:46:02
This can potentially result in an overflow error w
|
| + static int _initialSeed() native "Random_initialSeed"; |
| + |
| static int _nextSeed() { |
| - if (_prng == null) { |
| - // TODO(iposva): Use system to get a random seed. |
| - _prng = new Random(new DateTime.now().millisecondsSinceEpoch); |
| - } |
| // Trigger the PRNG once to change the internal state. |
| _prng._nextState(); |
| return _prng._state[kSTATE_LO]; |