Skip to content

Commit 85b3479

Browse files
Fix EmbeddedApp example
1 parent 606cb27 commit 85b3479

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Examples/Embedded/Sources/EmbeddedApp/_thingsThatShouldNotBeNeeded.swift

+12-1
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,20 @@ func strlen(_ s: UnsafePointer<Int8>) -> Int {
1717
return p - s
1818
}
1919

20+
enum LCG {
21+
static var x: UInt8 = 0
22+
static let a: UInt8 = 0x05
23+
static let c: UInt8 = 0x0b
24+
25+
static func next() -> UInt8 {
26+
x = a &* x &+ c
27+
return x
28+
}
29+
}
30+
2031
@_cdecl("arc4random_buf")
2132
public func arc4random_buf(_ buffer: UnsafeMutableRawPointer, _ size: Int) {
2233
for i in 0..<size {
23-
buffer.storeBytes(of: UInt8.random(in: 0...255), toByteOffset: i, as: UInt8.self)
34+
buffer.storeBytes(of: LCG.next(), toByteOffset: i, as: UInt8.self)
2435
}
2536
}

0 commit comments

Comments
 (0)