random numbers
Marty
mburkey at gara.une.oz
Tue Aug 22 09:54:04 AEST 1989
In article <876.24EFA953 at busker.FIDONET.ORG>, Rik.Stevans at f226.n105.z1.FIDONET.ORG (Rik Stevans) writes:
> Does anyone have a good random number generator for 'c'? i need a
> function which will return an integer less than zero (just like rnd
There are two random functions that have been written for C. (Though I
haven't the faintest wot compilers have got 'em and wot haven't).
rand() and random() come with associated srand() and srandom() functions
to start the sewuence at a given point rather tha at the beginning. If
they happen to be in your libraries then they will most likely happen to
be in math.h - but if they ain't there then they ain't anywhere.
Failing that, just about any Comp. Svi. text book will have a random
number generation algorithm.
-Marty.
More information about the Comp.lang.c
mailing list