Signal-iOS/SignalUI/Appearance
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
..
ChatColors.swift Stop using arc4random in Swift files 2022-05-03 10:19:07 -05:00
ColorOrGradient.swift Add SignalUI framework target. 2021-10-19 09:39:53 -03:00
ColorOrGradientSwatchView.swift Fix a whole bunch of warnings 2021-10-21 21:11:26 -07:00
Theme.h refactored background color handling (part of cell configuration), fixed colors searching on iPad, changed handling of theme change during multi-selection 2022-01-26 10:46:08 +01:00
Theme.m improve ContactsManagerCache performance (#4026) 2022-03-03 09:30:31 +01:00
Theme+OWS.swift Add "Donation Receipts" view 2022-04-11 16:21:12 -05:00