How do I get random #s?
John Hascall
hascall at atanasoff.cs.iastate.edu
Tue Feb 7 04:51:21 AEST 1989
In article <16034 at tiger.oxy.edu> bagpiper at oxy.edu (Michael Paul Hunter) writes:
>In article <9570 at smoke.BRL.MIL> gwyn at smoke.BRL.MIL (Doug Gwyn ) writes:
>>In article <19415 at dhw68k.cts.com> tsource at 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
More information about the Comp.lang.c
mailing list