mz.c

Ray Trent trent at cit-vax.Caltech.Edu
Thu Nov 6 13:56:50 AEST 1986


In article <823 at zen.BERKELEY.EDU> chapman at cory.Berkeley.EDU.UUCP (Brent Chapman) writes:
>Anyway, the definition of macro oneof() needs to be changed from:
>    #define oneof(n)    (int)(((long)(n) * rand())/32768)
>to:
>    #define oneof(n)    (int)(((long)(n) * (rand() & 0x7fff))/32768)

I suppose this works...but isn't:

     #define oneof(n)    (rand() % (n) + 1)

more intuitive and efficient?

-- 
DISCLAIMER, DAMMIT!!!! Any errors in this posting are computer errors
generated by my spelling/syntax/usage/factual content checker.
					../ray\..
 (trent at csvax.caltech.edu, rat at caltech.bitnet, ...seismo!cit-vax!trent)



More information about the Comp.sources.unix mailing list