1: /*
   2:  * Copyright (c) 1980 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  *
   6:  *	@(#)rand_.c	5.2	6/7/85
   7:  *
   8:  * Routines to return random values
   9:  *
  10:  * calling sequence:
  11:  *	double precision d, drand
  12:  *	i = irand(iflag)
  13:  *	x = rand(iflag)
  14:  *	d = drand(iflag)
  15:  * where:
  16:  *	If arg is 1, generator is restarted. If arg is 0, next value
  17:  *	is returned. Any other arg is a new seed for the generator.
  18:  *	Integer values will range from 0 thru 2147483647.
  19:  *	Real values will range from 0.0 thru 1.0
  20:  *	(see rand(3))
  21:  */
  22: 
  23: #if vax
  24: #define RANDMAX     2147483647
  25: #else   vax
  26: #if pdp11
  27: #define RANDMAX     32767
  28: #else   pdp11
  29:     UNKNOWN MACHINE!
  30: #endif	pdp11
  31: #endif	vax
  32: 
  33: long irand_(iarg)
  34: long *iarg;
  35: {
  36:     if (*iarg) srand((int)*iarg);
  37: #if pdp11
  38:     return(( ((long)rand()) << 16) | rand());
  39: #else   pdp11
  40:     return( rand() );
  41: #endif	pdp11
  42: }
  43: 
  44: float rand_(iarg)
  45: long *iarg;
  46: {
  47:     if (*iarg) srand((int)*iarg);
  48:     return( (float)(rand())/(float)RANDMAX );
  49: }
  50: 
  51: double drand_(iarg)
  52: long *iarg;
  53: {
  54:     if (*iarg) srand((int)*iarg);
  55:     return( (double)(rand())/(double)RANDMAX );
  56: }

Defined functions

drand_ defined in line 51; never used
irand_ defined in line 29; never used
rand_ defined in line 44; never used

Defined macros

RANDMAX defined in line 27; used 2 times
Last modified: 1985-06-08
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 824
Valid CSS Valid XHTML 1.0 Strict