Operating System - HP-UX
1830250 Members
2611 Online
110000 Solutions
New Discussion

Re: Random Number generator

 
SOLVED
Go to solution
Peter Day_2
Occasional Advisor

Random Number generator

Does any know how I can generate a random number. Other than the awk'{print rand()}' which only produces a random number from 0 - 1, and I haven't found a way to get that into a variable.

Any help would be very welcome.
6 REPLIES 6
Mark Grant
Honored Contributor
Solution

Re: Random Number generator


"echo $RANDOM" is probably your easiest bet.

but if you did want to get your awk thing into a variable you'd go

myrandom=`awk'{print rand()}'`
Never preceed any demonstration with anything more predictive than "watch this"
G. Vrijhoeven
Honored Contributor

Re: Random Number generator

Hi,

Check:

http://www.software.hp.com/cgi-bin/swdepot_parser.cgi/cgi/displayProductInfo.pl?productNumber=KRNG11I

cat /dev/random | while read VAR1 VAR2 etc
do

etc...


done

HTH,

Gideon
Peter Day_2
Occasional Advisor

Re: Random Number generator

Thanks Mark.

You didn't work for IBM did you ??.

Pete
Mark Grant
Honored Contributor

Re: Random Number generator

Actually peter I did :)

Never preceed any demonstration with anything more predictive than "watch this"
Steven E. Protter
Exalted Contributor

Re: Random Number generator

http://software.hp.com/portal/swdepot/displayProductInfo.do?productNumber=KRNG11I

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
H.Merijn Brand (procura
Honored Contributor

Re: Random Number generator

What OS? HP-UX 11i has /dev/random, it is available for 11.00 from http://freshmeat.net/projects/hpux11-random/

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn