<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: puzzle no - 2 in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/puzzle-no-2/m-p/2787364#M78732</link>
    <description>HI&lt;BR /&gt;&lt;BR /&gt;Try these:-&lt;BR /&gt;&lt;BR /&gt;Get a randon number in scripts&lt;BR /&gt;NOTE: produce a number  0 - $LIMIT-1&lt;BR /&gt;  nawk:&lt;BR /&gt;     set num=`nawk 'BEGIN { srand();&lt;BR /&gt;               printf "%d",  rand()*$LIMIT&lt;BR /&gt;              }' /dev/null`&lt;BR /&gt;&lt;BR /&gt;  date:&lt;BR /&gt;     set date=`date +%j%H%M%S`&lt;BR /&gt;     set num=`expr $date \% $LIMIT`&lt;BR /&gt;&lt;BR /&gt;  (k/z/ba)sh&lt;BR /&gt;      $RANDOM  produces a number from 0.0 to 1.0&lt;BR /&gt;-----------------------------------------------------&lt;BR /&gt;Use a psudo random number generator&lt;BR /&gt;   #!/bin/csh -f&lt;BR /&gt;   #&lt;BR /&gt;   #  Random limit   -- produce random number from 1 to limit&lt;BR /&gt;   #&lt;BR /&gt;   set multiplier = 25173&lt;BR /&gt;   set increment =  13849&lt;BR /&gt;   set modulus =    65536&lt;BR /&gt;   set seedfile =   $HOME/.rnd  # seed file to use&lt;BR /&gt;&lt;BR /&gt;   if ( ! -f $seedfile ) then&lt;BR /&gt;      echo '17' &amp;gt; $seedfile&lt;BR /&gt;   endif&lt;BR /&gt;&lt;BR /&gt;   @ number = ( `cat $seedfile` * $multiplier + $increment ) % $modulus&lt;BR /&gt;   echo $number &amp;gt; $seedfile&lt;BR /&gt;&lt;BR /&gt;   @ number = $number % $1 + 1&lt;BR /&gt;   echo $number&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Paula</description>
    <pubDate>Fri, 16 Aug 2002 06:07:23 GMT</pubDate>
    <dc:creator>Paula J Frazer-Campbell</dc:creator>
    <dc:date>2002-08-16T06:07:23Z</dc:date>
    <item>
      <title>puzzle no - 2</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/puzzle-no-2/m-p/2787363#M78731</link>
      <description>Hi,&lt;BR /&gt;Can anybody write a shell script which can&lt;BR /&gt;generate random numbers and append to a output&lt;BR /&gt;file ?.&lt;BR /&gt;&lt;BR /&gt;CONDITION: Should NOT use echo $RANDOM&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;U.SivaKumar</description>
      <pubDate>Fri, 16 Aug 2002 04:01:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/puzzle-no-2/m-p/2787363#M78731</guid>
      <dc:creator>U.SivaKumar_2</dc:creator>
      <dc:date>2002-08-16T04:01:02Z</dc:date>
    </item>
    <item>
      <title>Re: puzzle no - 2</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/puzzle-no-2/m-p/2787364#M78732</link>
      <description>HI&lt;BR /&gt;&lt;BR /&gt;Try these:-&lt;BR /&gt;&lt;BR /&gt;Get a randon number in scripts&lt;BR /&gt;NOTE: produce a number  0 - $LIMIT-1&lt;BR /&gt;  nawk:&lt;BR /&gt;     set num=`nawk 'BEGIN { srand();&lt;BR /&gt;               printf "%d",  rand()*$LIMIT&lt;BR /&gt;              }' /dev/null`&lt;BR /&gt;&lt;BR /&gt;  date:&lt;BR /&gt;     set date=`date +%j%H%M%S`&lt;BR /&gt;     set num=`expr $date \% $LIMIT`&lt;BR /&gt;&lt;BR /&gt;  (k/z/ba)sh&lt;BR /&gt;      $RANDOM  produces a number from 0.0 to 1.0&lt;BR /&gt;-----------------------------------------------------&lt;BR /&gt;Use a psudo random number generator&lt;BR /&gt;   #!/bin/csh -f&lt;BR /&gt;   #&lt;BR /&gt;   #  Random limit   -- produce random number from 1 to limit&lt;BR /&gt;   #&lt;BR /&gt;   set multiplier = 25173&lt;BR /&gt;   set increment =  13849&lt;BR /&gt;   set modulus =    65536&lt;BR /&gt;   set seedfile =   $HOME/.rnd  # seed file to use&lt;BR /&gt;&lt;BR /&gt;   if ( ! -f $seedfile ) then&lt;BR /&gt;      echo '17' &amp;gt; $seedfile&lt;BR /&gt;   endif&lt;BR /&gt;&lt;BR /&gt;   @ number = ( `cat $seedfile` * $multiplier + $increment ) % $modulus&lt;BR /&gt;   echo $number &amp;gt; $seedfile&lt;BR /&gt;&lt;BR /&gt;   @ number = $number % $1 + 1&lt;BR /&gt;   echo $number&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Paula</description>
      <pubDate>Fri, 16 Aug 2002 06:07:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/puzzle-no-2/m-p/2787364#M78732</guid>
      <dc:creator>Paula J Frazer-Campbell</dc:creator>
      <dc:date>2002-08-16T06:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: puzzle no - 2</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/puzzle-no-2/m-p/2787365#M78733</link>
      <description>&lt;BR /&gt;perl -e 'srand(time()^$$);while (1){print int(rand(1)*255);}'&lt;BR /&gt;&lt;BR /&gt;This will print random numbers from 1-255 seeded by the current time when invoked, you can redirect output to a file. You will need perl installed though.&lt;BR /&gt;</description>
      <pubDate>Fri, 16 Aug 2002 06:10:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/puzzle-no-2/m-p/2787365#M78733</guid>
      <dc:creator>Stefan Farrelly</dc:creator>
      <dc:date>2002-08-16T06:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: puzzle no - 2</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/puzzle-no-2/m-p/2787366#M78734</link>
      <description>echo "" | awk '{srand();printf("%3d\n",rand()*100)}' &amp;gt;&amp;gt; /tmp/randfile</description>
      <pubDate>Fri, 16 Aug 2002 13:00:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/puzzle-no-2/m-p/2787366#M78734</guid>
      <dc:creator>Tom Danzig</dc:creator>
      <dc:date>2002-08-16T13:00:31Z</dc:date>
    </item>
    <item>
      <title>Re: puzzle no - 2</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/puzzle-no-2/m-p/2787367#M78735</link>
      <description>Okay, pure POSIX or Korn&lt;BR /&gt;&lt;BR /&gt;OUTFILE="myfile.out"&lt;BR /&gt;RANDY=$((${$} + ${SECONDS}))&lt;BR /&gt;while [[ 1 -eq 1 ]]&lt;BR /&gt;  do&lt;BR /&gt;    RANDY=$(((${RANDY} * 13107) + 25171))&lt;BR /&gt;    echo ${RANDY} &amp;gt;&amp;gt; ${OUTFILE}&lt;BR /&gt;  done&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 16 Aug 2002 13:18:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/puzzle-no-2/m-p/2787367#M78735</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-08-16T13:18:50Z</dc:date>
    </item>
  </channel>
</rss>

