OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import "dart:scalarlist"; | 5 import "dart:typeddata"; |
6 | 6 |
7 // A VM patch of the dart:math library. | 7 // A VM patch of the dart:math library. |
8 patch num pow(num x, num exponent) { | 8 patch num pow(num x, num exponent) { |
9 if (exponent is int) { | 9 if (exponent is int) { |
10 return x.pow(exponent); | 10 return x.pow(exponent); |
11 } | 11 } |
12 // Double.pow will call exponent.toDouble(). | 12 // Double.pow will call exponent.toDouble(). |
13 return x.toDouble().pow(exponent); | 13 return x.toDouble().pow(exponent); |
14 } | 14 } |
15 | 15 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 112 |
113 static int _nextSeed() { | 113 static int _nextSeed() { |
114 if (_prng == null) { | 114 if (_prng == null) { |
115 // TODO(iposva): Use system to get a random seed. | 115 // TODO(iposva): Use system to get a random seed. |
116 _prng = new Random(new DateTime.now().millisecondsSinceEpoch); | 116 _prng = new Random(new DateTime.now().millisecondsSinceEpoch); |
117 } | 117 } |
118 // Trigger the PRNG once to change the internal state. | 118 // Trigger the PRNG once to change the internal state. |
119 return _prng._nextInt32(); | 119 return _prng._nextInt32(); |
120 } | 120 } |
121 } | 121 } |
OLD | NEW |