OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 part of $LIBRARYNAME; | 5 part of $LIBRARYNAME; |
6 | 6 |
7 $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
{ | 7 $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
{ |
8 | 8 |
9 TypedData getRandomValues(TypedData array) { | 9 TypedData getRandomValues(TypedData array) { |
10 $if DART2JS | |
11 return _getRandomValues(array); | 10 return _getRandomValues(array); |
12 $else | |
13 var random = _getRandomValues(array); | |
14 // The semantics of the operation are that it modifies the argument, but we | |
15 // have no way of making a Dart typed data created initially in Dart referen
ce | |
16 // externalized storage. So we copy the values back from the returned copy. | |
17 // TODO(alanknight): Make this less ridiculously slow. | |
18 for (var i = 0; i < random.length; i++) { | |
19 array[i] = random[i]; | |
20 } | |
21 return array; | |
22 $endif | |
23 } | 11 } |
24 | 12 |
25 $!MEMBERS | 13 $!MEMBERS |
26 } | 14 } |
OLD | NEW |