calling systime() function by awk

Joined
Aug 5, 2015
Messages
6
Reaction score
0
Points
1
Hi everyone,
I want to use "srand" in a program with "awk" on my mac,
and to generate different numbers I want to use systime() as seed.
But this error occurs:
"awk: calling undefined function systime"

Could you please let me know How I can solve the problem?

I did not see any function about time in " man awk" description.
 

Raz0rEdge

Well-known member
Staff member
Moderator
Joined
Jul 17, 2009
Messages
16,035
Reaction score
2,442
Points
113
Location
MA
Your Mac's Specs
2022 Mac Studio M1 Max, 2023 M2 MBA
You are mixing and matching things that aren't related.

I would recommend that you take a moment to read up and get familiar with what AWK is and does.

If you look at the Numeric Functions supported by AWK, you'll see the srand() without any argument uses the current date and time as the seed automatically. Providing a integer means that the random number will go up to that integer..
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top