RandomTime
gives a pseudorandom time of day.
RandomTime[{timemin,timemax}]
gives a pseudorandom time between the times timemin and timemax.
RandomTime[time]
gives a pseudorandom times between the start and end of the time period time.
RandomTime[quantity]
gives a pseudorandom time between now and the time quantity duration from now.
RandomTime[range,n]
gives a list of n pseudorandom times.
Details and Options
- RandomTime is used to generate time objects within a particular time period (i.e. a given hour, minute, second or a set of arbitrary points in time).
- RandomTime[{timemin,timemax}] chooses times with a uniform probability distribution between timemin and timemax.
- RandomTime[time] gives a time between the beginning and end of the specified time, based on its granularity, and is equivalent to RandomTime[DateBounds[time]]. Specifications for time may be a DateObject, TimeObject or DateInterval.
- RandomTime[quantity] gives a time between Now and Now+quantity, where quantity is a duration specified using Quantity with a time unit. RandomTime[{quantitymin,quantitymax}] gives a time between Now+quantitymin and Now+quantitymax.
- RandomTime[range,{n1,n2,…}] gives an n1×n2×… array of pseudorandom times.
- The following options can be specified for generated times:
-
DateGranularity Automatic granularity of generated times TimeZone Automatic time zone of generated times - RandomTime gives a different sequence of pseudorandom times whenever you run the Wolfram Language. You can start with a particular seed using SeedRandom.
Examples
open allclose allBasic Examples (7)
Options (2)
DateGranularity (1)
By default, times are generated with "Instant" granularity:
Use DateGranularity"Minute" to generate a pseudorandom minute:
Text
Wolfram Research (2022), RandomTime, Wolfram Language function, https://reference.wolfram.com/language/ref/RandomTime.html.
CMS
Wolfram Language. 2022. "RandomTime." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RandomTime.html.
APA
Wolfram Language. (2022). RandomTime. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RandomTime.html