Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!ncar!gatech!mcnc!decvax!ima!cfisun!lakart!dg From: dg@lakart.UUCP (David Goodenough) Newsgroups: comp.unix.questions Subject: Re: random numbers in a C shell script? Message-ID: <540@lakart.UUCP> Date: 8 May 89 14:55:22 GMT References: <1501@cmx.npac.syr.edu> Organization: Lakart Corporation, Newton, MA Lines: 26 gefuchs@skolem.uucp (Gill E. Fuchs) sez: > Bon Jorno net, > > how would one go about getting a random numba in a C shell script? > > muchas randomas gracias #! /bin/csh @ rng = `date | tr : ' ' | awk '{ print $3 * $4 * $5 * $6}'` + $$ echo $rng Gives "reasonable" oneshot random numbers. If you need a mess of them, then take $rng, and a LCG (did I get the term right???): @rng = $rng * something + something_else which might keep you happy. Failing this, get on with Knuth Volume 2 and awk. -- dg@lakart.UUCP - David Goodenough +---+ IHS | +-+-+ ....... !harvard!xait!lakart!dg +-+-+ | AKA: dg%lakart.uucp@xait.xerox.com +---+