3 ms·
Swift 4.2 (2018) introduced a cross platform random number API. (0..<10).randomElement()
by slavapestov 7y ago
Swift 4.2 (2018) introduced a cross platform random number API.
(0..<10).randomElement()
- pjmlp 7y agoYet they didn't bother to update the example on the introduction to Swift. There are plenty of other examples I can look for, like file handling.
- slavapestov 7y agoFile handling can be done using Foundation, which I believe has API parity between Darwin and Linux at least. I think the point of the example was to demonstrate importing platform-specific modules, not random number generation per se. But you're right, it should probably be updated to do something else.
- coldtea 7y ago>Yet they didn't bother to update the example on the introduction to Swift. There are widely popular FOSS languages with much much less documentation...