Subject: Re: Very small numbers from awk's rand()
To: Chris Rupnik <chrisr@geeknet.montreal.qc.ca>
From: Simon Burge <simonb@netbsd.org>
List: port-alpha
Date: 05/10/2000 13:12:12
Chris Rupnik wrote:

> Something has to be wrong here, as i get the following from my netbsd
> 1.4/sparc
> 
> 0.487477
> 0.0715607
> 0.00395315
> 0.832913
> 0.765252
> 0.599829
> 0.131783
> 0.88603
> 0.0732417
> 0.34195 
> 
> How can these be the same?

Because "srand()" isn't called first.  Check out the man page for awk.
For example:

	awk '{srand() ; for(i=1;i<=10;i++) print rand(); exit}'

will print something different (most of the time).

Simon.