Signal-iOS/SignalUI
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
..
Appearance Stop using arc4random in Swift files 2022-05-03 10:19:07 -05:00
Categories Fix incorrect layouts constraints in AL helper method. 2022-04-22 11:08:20 -07:00
Environment Report HTTP status code when web sockets fail to connect 2022-03-28 15:25:37 -07:00
Fonts Add new fonts for text stories 2022-03-17 14:30:19 -07:00
Payments Revert "Use shorter URLs for MOB FOG" 2022-05-02 20:39:52 -05:00
SignalUI.docc Add SignalUI framework target. 2021-10-19 09:39:52 -03:00
UI Fix typos 2022-03-18 11:31:06 -07:00
Utils moved older stringsdict changes into new branch; minor changes (#4205) 2022-04-28 17:41:43 +02:00
ViewControllers Localize user-visible file sizes. 2022-04-29 09:57:56 -05:00
ViewModels Fix quoting story reactions 2022-04-21 11:00:12 -07:00
Views Change references from master to main 2022-05-02 10:30:40 -05:00
Wallpapers PR Feedback: Remove notImplemented altogether 2022-04-13 20:21:47 -07:00
SignalUI-Prefix.pch minor changes due to changed name of NSLocalizedStringFromAppBundle (now OWSLocalizedString) and new location of swift function and preprocessor definition 2022-03-11 14:08:26 +01:00
SignalUI.h Change phone number. 2021-11-19 14:28:18 -03:00