# 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 all

## Basic Examples(7)

A random time of the day:

A random time between 6am and 4pm:

A random time between noon and 1pm:

A random time between now and 3 hours from now:

A random time in the past two minutes:

A random time between the next hour and the hour after:

Five random times between 3 and 4am:

## Options(2)

### DateGranularity(1)

By default, times are generated with "Instant" granularity:

Use DateGranularity"Minute" to generate a pseudorandom minute:

### TimeZone(1)

Generate times in Lima's time zone: