Signal-iOS/SignalServiceKit/tests
Evan Hahn 04d7bb7462 Stop using arc4random in Swift files
This removes calls to `arc4random` and `arc4random_uniform` and replaces
them with calls to `Int.random` or equivalent.

These are a little less readable, which may be [why SwiftLint doesn't
like them][0]. (SwiftLint calls them "legacy", possibly because they're
not strong random number generators, but I couldn't find a clear
explanation for this anywhere, including [the original PR][1].)

This is the kind of change that's error-prone, so I wrote [a simple
script to help avoid regressions][2]. The script runs 10,000 iterations
of the old and new RNG and compares the ranges, reporting differences.
(Some differences are likely, like the ones that involve floats; others
are very unlikely to have differences.)

`git grep arc4random | grep swift` returns no results after this change.
Same for [everything else SwiftLint checks for][3].

[0]: https://realm.github.io/SwiftLint/legacy_random.html
[1]: https://github.com/realm/SwiftLint/pull/2419
[2]: https://gist.github.com/EvanHahn-Signal/9c75c9f484f4778149cbde3eafc9b285
[3]: ea6cc50890/Source/SwiftLintFramework/Rules/Idiomatic/LegacyRandomRule.swift (L23-L27)
2022-05-03 10:19:07 -05:00
..
Account Move pre-key culling logic from TSPreKeyManager to the stores 2022-04-07 10:23:39 -07:00
Contacts Stop using arc4random in Swift files 2022-05-03 10:19:07 -05:00
Devices Update to LibSignalClient v0.15.0 2022-03-24 11:55:45 -07:00
Groups Rework the 'pending member requests and invites' view. 2020-09-03 18:33:07 -03:00
Messages Change references from master to main 2022-05-02 10:30:40 -05:00
Network Simplify AFNetworking usage. 2021-10-15 10:50:37 -03:00
Security Apply script to normalize includes and imports. 2021-10-21 09:21:10 -03:00
Storage Fix for non-messages being filtered out of interaction results 2022-04-15 15:42:33 -07:00
Util Stop using arc4random in Swift files 2022-05-03 10:19:07 -05:00
SSKBaseTestObjC.h Respond to CR. 2021-10-21 09:21:31 -03:00
SSKBaseTestObjC.m Apply script to normalize includes and imports. 2021-10-21 09:21:10 -03:00
SSKBaseTestSwift.swift OWSMessageDecrypter should use destinationUuid to choose local stores 2022-04-14 16:47:46 -07:00
SSKSwiftTests.swift Convert to just using CocoaPods for dependencies 2020-01-02 12:03:57 -08:00