www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/11/03/19:48:14

Date: Thu, 3 Nov 1994 10:37:41 -0500 (EST)
From: Ed Phillips <flaregun AT udel DOT edu>
To: Dong Liu <dliu AT faraday-gw DOT njit DOT edu>
Cc: DJGPP AT sun DOT soe DOT clarkson DOT edu
Subject: Re: How about random (Was Is it random number sequence?)

On Wed, 2 Nov 1994, Dong Liu wrote:

> How about the function random, let me cite the man page on SunOS
> 
> DESCRIPTION
>   random() uses a non-linear additive feedback  random  number
>   generator employing a default table of size 31 long integers
>   to return successive pseudo-random numbers in the range from
>   0  to (2**31)-1.  The period of this random number generator
>   is very large, approximately 16*((2**31)-1).
>   random/srandom have (almost) the same calling  sequence  and
>   initialization  properties as rand/srand.  The difference is
>   that rand(3V) produces a much  less  random  sequence  -  in
>   fact,  the  low  dozen  bits  generated by rand go through a
>   cyclic pattern.  All the  bits  generated  by  random()  are
>   usable.  For example,
>        random()&01
>   will produce a random binary value.
>   ......
> 
> Here is my little test program
> 
> main(int argc, char **argv)
> {
>         int i;
> 	    srandom(atoi(argv[1]));
> 	    for(i=0; i<30; ++i)
> 		      printf(" %d", random()&3);
> 	      putchar('\n');
> }
> 

	random() is there!!!  At least it is in libc.a from V1.12m2.

	Ed

/****************************************************************************/
/* Ed Phillips  flaregun AT udel DOT edu              University of Delaware       */
/* Jr Systems Programmer  (302) 831-6082    IT/Network and Systems Services */
/****************************************************************************/


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019