<?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: Random # in ksh script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/random-in-ksh-script/m-p/2785445#M78314</link>
    <description>How about this?&lt;BR /&gt;&lt;BR /&gt;guessed=$((${RANDOM} % 3001))&lt;BR /&gt;</description>
    <pubDate>Tue, 13 Aug 2002 19:23:28 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2002-08-13T19:23:28Z</dc:date>
    <item>
      <title>Random # in ksh script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/random-in-ksh-script/m-p/2785444#M78313</link>
      <description>In KSH, there's a RANDOM parameter set by the shell.  I'd like to use a random number in my script, but this parameter picks a number betwee 0 and 32767.   I'd like a random number between 0 and 3000.   Is there a way to force this RANDOM parameter to use a range?  I wrote a little script to accomplish what I want, but it seems a bit klumzy:  &lt;BR /&gt;======&lt;BR /&gt;guessed=3817&lt;BR /&gt;upper=3816&lt;BR /&gt;while [[ $guessed -ge $upper ]]&lt;BR /&gt;do&lt;BR /&gt;        guessed=$RANDOM&lt;BR /&gt;done&lt;BR /&gt;echo $guessed&lt;BR /&gt;========&lt;BR /&gt;Is there a better way?&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 13 Aug 2002 19:17:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/random-in-ksh-script/m-p/2785444#M78313</guid>
      <dc:creator>Ron Bombard</dc:creator>
      <dc:date>2002-08-13T19:17:11Z</dc:date>
    </item>
    <item>
      <title>Re: Random # in ksh script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/random-in-ksh-script/m-p/2785445#M78314</link>
      <description>How about this?&lt;BR /&gt;&lt;BR /&gt;guessed=$((${RANDOM} % 3001))&lt;BR /&gt;</description>
      <pubDate>Tue, 13 Aug 2002 19:23:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/random-in-ksh-script/m-p/2785445#M78314</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-08-13T19:23:28Z</dc:date>
    </item>
    <item>
      <title>Re: Random # in ksh script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/random-in-ksh-script/m-p/2785446#M78315</link>
      <description>Hmmm... your MOJO is wicked cool!&lt;BR /&gt;Worked great.  Too bad I don't understand HOW...  Guess I'll just "chalk it off" as magic.&lt;BR /&gt;Thanks!</description>
      <pubDate>Tue, 13 Aug 2002 19:26:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/random-in-ksh-script/m-p/2785446#M78315</guid>
      <dc:creator>Ron Bombard</dc:creator>
      <dc:date>2002-08-13T19:26:26Z</dc:date>
    </item>
    <item>
      <title>Re: Random # in ksh script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/random-in-ksh-script/m-p/2785447#M78316</link>
      <description>How about the modulo operator?&lt;BR /&gt;&lt;BR /&gt;((num=guessed%3000))&lt;BR /&gt;&lt;BR /&gt;Tom</description>
      <pubDate>Tue, 13 Aug 2002 19:28:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/random-in-ksh-script/m-p/2785447#M78316</guid>
      <dc:creator>Tom Maloy</dc:creator>
      <dc:date>2002-08-13T19:28:00Z</dc:date>
    </item>
    <item>
      <title>Re: Random # in ksh script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/random-in-ksh-script/m-p/2785448#M78317</link>
      <description>not that much magic... you see this easily&lt;BR /&gt;echo ${RANDOM}  &lt;BR /&gt;$((echo hello world))&lt;BR /&gt;&lt;BR /&gt;...BTW man sh-posix ...&lt;BR /&gt;</description>
      <pubDate>Wed, 14 Aug 2002 05:25:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/random-in-ksh-script/m-p/2785448#M78317</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2002-08-14T05:25:08Z</dc:date>
    </item>
  </channel>
</rss>

