v05i039: Random Name Generator Source Code

Amos Shapir amos at taux02.UUCP
Mon Nov 14 17:40:24 AEST 1988


There was a bug in the macro definition of rnd(); also toupper does not
have a '_' prepended on BSD systems (not on Sequent's dynix, anyway).


		o /		o /		o /		o /
--Cut-here-------X---------------X---------------X---------------X----
		o \		o \		o \		o \

*** name.c.orig	Mon Nov 14 09:32:45 1988
--- name.c	Mon Nov 14 09:19:03 1988
***************
*** 13,18
  #define srandom srand48
  #define random lrand48
  #else
  #include <strings.h>
  #endif
  

--- 13,19 -----
  #define srandom srand48
  #define random lrand48
  #else
+ #define _toupper(c) toupper(c)
  #include <strings.h>
  #endif
  
***************
*** 23,29
  #define MAXNAME 30
  #define MINLENGTH 3
  #define RANGE 6
! #define rnd(n) ((unsigned) random() % (unsigned) n)
  
  /* Since "y" and "'" appear twice, once in each array, all other 
     letters are doubled to keep the distribution even. */

--- 24,30 -----
  #define MAXNAME 30
  #define MINLENGTH 3
  #define RANGE 6
! #define rnd(n) ((unsigned) random() % (unsigned) (n))
  
  /* Since "y" and "'" appear twice, once in each array, all other 
     letters are doubled to keep the distribution even. */

		o /		o /		o /		o /
--Cut-here-------X---------------X---------------X---------------X----
		o \		o \		o \		o \
May the Source be with you, always...
-- 
	Amos Shapir				amos at nsc.com
National Semiconductor (Israel) P.O.B. 3007, Herzlia 46104, Israel
Tel. +972 52 522261  TWX: 33691, fax: +972-52-558322
34 48 E / 32 10 N			(My other cpu is a NS32532)



More information about the Comp.sources.bugs mailing list