Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!aero-c!gumby.dsd.trw.com!shark.dsd.trw.com!suhre From: suhre@shark.dsd.trw.com (Maurice E. Suhre) Newsgroups: comp.unix.questions Subject: Re: random numbers in awk? Message-ID: <1991May13.221822.27731@gumby.dsd.TRW.COM> Date: 13 May 91 22:18:22 GMT References: <26019@adm.brl.mil> <1991Apr24.041134.14519@athena.mit.edu> <1136@mwtech.UUCP> Sender: news@gumby.dsd.TRW.COM Reply-To: suhre@shark.dsd.trw.com.UUCP (Maurice E. Suhre) Organization: TRW Space and Defense Lines: 23 In article <1136@mwtech.UUCP> martin@mwtech.UUCP (Martin Weitzel) writes: +In article <1991Apr24.041134.14519@athena.mit.edu> jik@athena.mit.edu (Jonathan I. Kamens) writes: +> +> [...] another possibility is +>to use the jot(1) program to generate a random number, if your system has jot. + +SysV User's should note that they have a similar program, called random. +It's range of output values is restricted to 0..255 (the upper limit must +be specified as a calling argument). If you need larger numbers, you +can, of course, call random twice, multiply the result of the first +call by 256, add the result of the second call, and take the whole thing +modulo the largest number you want. +-- +Martin Weitzel, email: martin@mwtech.UUCP, voice: 49-(0)6151-6 56 83 Be advised that the operations mentioned (multiplication, modulo) will, in general, change the distribution of the random numbers. That is, if you started with uniformly distributed random numbers, then what you will come out with will not be uniformly distributed. -- Maurice Suhre suhre@trwrb.dsd.trw.com