Randomly create time in UNIX

Hey,

How can i create randomly create time N times.

Suppose i want to create data for a particualr date 5 times...

Mon Jan 19 11:42:50
Mon Jan 19 19:16:40
Mon Jan 19 12:12:33
Mon Jan 19 14:26:27
Mon Jan 19 12:29:53
Mon Jan 19 13:30:31

I want the script to create N times randome time i want to create for the same.
I will give the input N for the same.

Thanks,

A starting point?

$ for i in 1 2 3 4 5; do printf "%02d:%02d:%02d\n" $((RANDOM%24)) $((RANDOM%60)) $((RANDOM%60)); done
16:23:11
02:15:15
23:07:02
00:02:20
20:15:06

But what did you try?

1 Like

Very nice solution Scott!