This response will be left intentionally vague. "Random data" doesn't tell us much. Give us more information and you will get a more useful answer. Until then, I take free reign to stab in the dark.
"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:
$ 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
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.
| [reply] [d/l] [select] |
Well, you can get started here: Random.
As far as "best practices", it really depends on why you want random numbers and what you are going to do with them...
| [reply] |
I like Math::Random a lot. It can give you random data with a selectable probability distribution.
As for "best practices", try googling the cryptographic literatere for 'prng' (pseudo-random number generat{or,ion}). The ideal thing (modulo techno-paranoia) is a hardware random number generator supported by the kernel. Kernel /dev/urandom is generally good. Non-pseudo generators all rely on some source of well-characterized but unpredictable noise.
| [reply] |