Generate times for A/B scenarios

ab_time_normal(hr = 8.5, sd = 0.5, n = 1)

Arguments

hr

Number representing the hour of day of departure (on average). 8.5, for example represents 08:30.

sd

The standard deviation in hours of the distribution

n

The number of numbers representing times to return

Value

An integer representing the time since midnight in seconds

Examples

time_lunch = ab_time_normal(hr = 12.5, sd = 0.25)
time_lunch
#> [1] 44543
# Back to a formal time class
as.POSIXct(trunc(Sys.time(), units="days") + time_lunch)
#> [1] "2022-04-18 12:22:23 UTC"
time_morning = ab_time_normal(hr = 8.5, sd = 0.5)
as.POSIXct(trunc(Sys.time(), units="days") + time_morning)
#> [1] "2022-04-18 08:22:51 UTC"
time_afternoon = ab_time_normal(hr = 17, sd = 0.75)
as.POSIXct(trunc(Sys.time(), units="days") + time_afternoon)
#> [1] "2022-04-18 16:53:50 UTC"