Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!uhccux!munnari.oz.au!murtoa.cs.mu.oz.au!gwydir!gara!mburkey From: mburkey@gara.une.oz (Marty) Newsgroups: comp.lang.c Subject: Re: random numbers Message-ID: <1094@gara.une.oz> Date: 21 Aug 89 23:54:04 GMT References: <876.24EFA953@busker.FIDONET.ORG> Organization: University of New England, Armidale, Australia Lines: 15 In article <876.24EFA953@busker.FIDONET.ORG>, Rik.Stevans@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.