We can generate random dates from a specific range of Unix Timestamps using the uniform distribution. For example, let’s generate 10 random dates:
library(lubridate) lubridate::as_datetime( runif(10, 1546290000, 1577739600))
Output:
[1] "2019-12-09 15:45:26 UTC" "2019-08-31 19:28:03 UTC" "2019-01-13 12:15:13 UTC" "2019-11-15 00:13:25 UTC"
[5] "2019-01-19 06:31:10 UTC" "2019-11-02 12:46:34 UTC" "2019-09-04 19:16:31 UTC" "2019-07-29 11:53:43 UTC"
[9] "2019-01-25 23:08:20 UTC" "2019-02-03 02:30:21 UTC"