Line data Source code
1 : import { Distribution } from "../types.ts"; 2 1 : import { integer } from "./integer.ts"; 3 : 4 : /** 5 : * Returns a Distribution that returns a random `Date` within the inclusive 6 : * range of [`start`, `end`]. 7 : * @param start The minimum `Date` 8 : * @param end The maximum `Date` 9 : */ 10 0 : export function date(start: Date, end: Date): Distribution<Date> { 11 0 : const distribution = integer(+start, +end); 12 0 : return engine => new Date(distribution(engine)); 13 0 : }