Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!sharkey!atanasoff!hascall From: hascall@atanasoff.cs.iastate.edu (John Hascall) Newsgroups: comp.lang.c Subject: Re: How do I get random #s? Message-ID: <767@atanasoff.cs.iastate.edu> Date: 6 Feb 89 18:51:21 GMT References: <19415@dhw68k.cts.com> <9570@smoke.BRL.MIL> <16034@tiger.oxy.edu> Reply-To: hascall@atanasoff.cs.iastate.edu (John Hascall) Organization: Iowa State U. Computer Science Department, Ames, IA Lines: 21 In article <16034@tiger.oxy.edu> bagpiper@oxy.edu (Michael Paul Hunter) writes: >In article <9570@smoke.BRL.MIL> gwyn@smoke.BRL.MIL (Doug Gwyn ) writes: >>In article <19415@dhw68k.cts.com> tsource@dhw68k.cts.com (Aryeh Friedman) writes: >>> I am new to C and I want to know how to get random numbers returned. >>ANSI C requires rand() to be provided, but probably your best bet for >>the time being is to provide your own generator. For example: >How about a quick hack at a random number generator that is >kindof-fairly uniorm in [0, 1]. My quick answer is to scale >rand...but that doesn't seem to be the best quick hack answer >to me. rand() s*cks (at least in VMS C, I don't know about others), I always MTH$RANDOM() rather than rand() on VMS systems. "The Art of Computer Programming", Vol II, Chap 3 should be of use. John Hascall