[comp.sys.sgi] rand in awk

finnd%vax.runit.unit.uninett@NAC.NO (Finn Drablos) (10/23/89)

I try to install an utility under Irix 3.1D, using awk. However, I get
problems with rand() and srand(). For example

  $awk '{ print rand() }'
  awk: syntax error near line 1
  awk: illegal statement near line 1
  $awk '{ print rand(2.0) }'

  2

  2

Not very useful, really. Am I doing something wrong, or is this a bug ?
Is there anything I can do to make it work (except for implementing my
own random number generator) ?

==================
Finn Drablos                 PHONE +47 7 597710        FAX +47 7 597708
MR-Senteret, SINTEF          MHS(EAN)    : finnd@vax.runit.unit.uninett
N-7034 TRONDHEIM, NORWAY     EARN/BITNET : drabloes@norunit
-----------------------------------------------------------------------

archer@elysium.corp.sgi.com (Archer Sully) (10/25/89)

In article <63*finnd@vax.runit.unit.uninett>, finnd%vax.runit.unit.uninett@NAC.NO (Finn Drablos) writes:
> I try to install an utility under Irix 3.1D, using awk. However, I get
> problems with rand() and srand(). For example
> 
>   $awk '{ print rand() }'
>   awk: syntax error near line 1
>   awk: illegal statement near line 1
>   $awk '{ print rand(2.0) }'
> 
>   2
> 
>   2
> 
> Not very useful, really. Am I doing something wrong, or is this a bug ?
> Is there anything I can do to make it work (except for implementing my
> own random number generator) ?

awk is still the old awk.  Try using 'nawk' instead.  It is the new awk
that is described in 'The AWK programming Language'.


--
Archer Sully (archer@sgi.com)

"life is short, filled with stuff"
		-- Lux Interior