Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!haven!aplcen!bink From: bink@aplcen.apl.jhu.edu (Ubben Greg) Newsgroups: comp.unix.questions Subject: Re: random numbers in a C shell script? Summary: Code (but not algorithm) ideas Message-ID: <1259@aplcen.apl.jhu.edu> Date: 17 May 89 03:18:04 GMT References: <1501@cmx.npac.syr.edu> <540@lakart.UUCP> Reply-To: bink@aplcen.apl.jhu.edu (Greg Ubben) Organization: The Johns Hopkins University, Baltimore MD Lines: 22 In article <540@lakart.UUCP> dg@lakart.UUCP (David Goodenough) writes: > ... > @ rng = `date | tr : ' ' | awk '{ print $3 * $4 * $5 * $6}'` + $$ > ... Not being qualified to play with the algorithm, I present instead another way of doing the SAME thing (in Bourne shell): rng=`date +"%d %H*%M*%S*$$+p" | dc` You'll probably want to throw in a MOD too. Another idea: combine in the output of a TIME or TIMEX (something like "timex date 2>&1 | sed ... | dc") Also, I'm not good at csh, but can't you just command substitute a date +"..." right into the @ instead of making awk do the math? Something like @ rng = `date +"%d * %H * %M * %S"` + $$ maybe with an EVAL thrown in for good measure? -- Greg Ubben bink@aplcen.apl.jhu.edu