Last active
December 2, 2024 13:21
-
-
Save Mez0/93c53ca40d28e50f6e4a5d923e643c87 to your computer and use it in GitHub Desktop.
Swift Generate Random Date
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Date { | |
static func random() -> Date { | |
let randomTime = TimeInterval(Int32.random(in: 0...Int32.max)) | |
return Date(timeIntervalSince1970: randomTime) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment