File tree Expand file tree Collapse file tree 3 files changed +11
-28
lines changed
test/api-digester/Outputs Expand file tree Collapse file tree 3 files changed +11
-28
lines changed Original file line number Diff line number Diff line change @@ -61,27 +61,6 @@ public protocol RandomNumberGenerator {
61
61
///
62
62
/// - Returns: An unsigned 64-bit random value.
63
63
mutating func next( ) -> UInt64
64
-
65
- // FIXME: De-underscore after swift-evolution amendment
66
- mutating func _fill( bytes buffer: UnsafeMutableRawBufferPointer )
67
- }
68
-
69
- extension RandomNumberGenerator {
70
- @inlinable
71
- public mutating func _fill( bytes buffer: UnsafeMutableRawBufferPointer ) {
72
- // FIXME: Optimize
73
- var chunk : UInt64 = 0
74
- var chunkBytes = 0
75
- for i in 0 ..< buffer. count {
76
- if chunkBytes == 0 {
77
- chunk = next ( )
78
- chunkBytes = UInt64 . bitWidth / 8
79
- }
80
- buffer [ i] = UInt8 ( truncatingIfNeeded: chunk)
81
- chunk >>= UInt8 . bitWidth
82
- chunkBytes -= 1
83
- }
84
- }
85
64
}
86
65
87
66
extension RandomNumberGenerator {
@@ -167,11 +146,4 @@ public struct SystemRandomNumberGenerator : RandomNumberGenerator {
167
146
swift_stdlib_random ( & random, MemoryLayout< UInt64> . size)
168
147
return random
169
148
}
170
-
171
- @inlinable
172
- public mutating func _fill( bytes buffer: UnsafeMutableRawBufferPointer ) {
173
- if !buffer. isEmpty {
174
- swift_stdlib_random ( buffer. baseAddress!, buffer. count)
175
- }
176
- }
177
149
}
Original file line number Diff line number Diff line change @@ -78,3 +78,6 @@ Protocol _NSStringCore has been removed
78
78
79
79
Constructor ManagedBuffer.init(_doNotCallMe:) has been removed
80
80
Func _makeAnyHashableUpcastingToHashableBaseType(_:storingResultInto:) has been removed
81
+
82
+ Func RandomNumberGenerator._fill(bytes:) has been removed
83
+ Func SystemRandomNumberGenerator._fill(bytes:) has been removed
Original file line number Diff line number Diff line change 3
3
4
4
import StdlibUnittest
5
5
import StdlibCollectionUnittest
6
+ import SwiftShims // for swift_stdlib_random
6
7
7
8
let RandomTests = TestSuite ( " Random " )
8
9
9
10
// _fill(bytes:)
10
11
12
+ extension RandomNumberGenerator {
13
+ func _fill( bytes buffer: UnsafeMutableRawBufferPointer ) {
14
+ guard let start = buffer. baseAddress else { return }
15
+ swift_stdlib_random ( start, buffer. count)
16
+ }
17
+ }
18
+
11
19
RandomTests . test ( " _fill(bytes:) " ) {
12
20
for count in [ 100 , 1000 ] {
13
21
var bytes1 = [ UInt8] ( repeating: 0 , count: count)
You can’t perform that action at this time.
0 commit comments