random numbers in awk?

Doug Gwyn gwyn at smoke.brl.mil
Wed May 15 05:58:10 AEST 1991


In article <1991May13.221822.27731 at gumby.dsd.TRW.COM> suhre at shark.dsd.trw.com.UUCP (Maurice E. Suhre) writes:
-In article <1136 at mwtech.UUCP> martin at mwtech.UUCP (Martin Weitzel) writes:
-+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. 
-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.

Be advised that the procedure Martin suggested does preserve uniformity.



More information about the Comp.unix.questions mailing list