in reply to Random Data
"best practices" for generating random dates?I'll assume this isn't a typo and you really do want random dates. rand 0x7fffffff is an easy way to get a random UNIX epoch timestamp (dates between 1970 and somewhere in 2038), which you can manipulate with localtime and friends to just get the M/D/Y part:
It's easy to modify this to pick a random time within a certain range (provided the range is within the UNIX epoch range), just find the timestamps of the endpoints. I'll leave that to you.$ perl -le 'print scalar localtime rand 0x7fffffff for 1 .. 5' Sun Apr 12 10:55:39 2009 Fri Nov 17 13:33:19 2023 Thu Jun 18 06:25:07 1987 Mon Jan 3 21:29:32 1994 Mon Aug 16 21:49:25 1999
blokhead
|
|---|