How do I get random #s?
Michael Paul Hunter
bagpiper at oxy.edu
Mon Feb 6 05:54:50 AEST 1989
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.
>
>Unfortunately the specific details of pseudo-random number generators
>in the system C libraries vary from system to system. Usually there
>is one called rand(), sometimes random(). UNIX System V has a family
>*rand48().
>
>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.
Mike
More information about the Comp.lang.c
mailing list