futureDate function
Returns a generator that produces a DateTime after a deterministic
anchor (DateTime.utc(2025)) within the given within duration on each
call.
Throws ArgumentError if within is negative.
Implementation
TValueGenerator futureDate({
required Random random,
Duration within = const Duration(days: 365),
}) {
_requireNonNegativeDuration(within);
final totalMs = within.inMilliseconds;
return () {
if (totalMs == 0) return _anchor;
final offsetMs = (random.nextDouble() * totalMs).toInt() + 1;
return _anchor.add(Duration(milliseconds: offsetMs));
};
}