<?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 Generating a random number in DCL in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/generating-a-random-number-in-dcl/m-p/4907799#M32317</link>
    <description>I want to generate a 7 digit random number in DCL and assign it to a symbol.&lt;BR /&gt;Can anybody help ?</description>
    <pubDate>Fri, 17 Jun 2005 05:56:48 GMT</pubDate>
    <dc:creator>Niall Godwin</dc:creator>
    <dc:date>2005-06-17T05:56:48Z</dc:date>
    <item>
      <title>Generating a random number in DCL</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/generating-a-random-number-in-dcl/m-p/4907799#M32317</link>
      <description>I want to generate a 7 digit random number in DCL and assign it to a symbol.&lt;BR /&gt;Can anybody help ?</description>
      <pubDate>Fri, 17 Jun 2005 05:56:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/generating-a-random-number-in-dcl/m-p/4907799#M32317</guid>
      <dc:creator>Niall Godwin</dc:creator>
      <dc:date>2005-06-17T05:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: Generating a random number in DCL</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/generating-a-random-number-in-dcl/m-p/4907800#M32318</link>
      <description>Niall,&lt;BR /&gt;&lt;BR /&gt;how random do you need it?&lt;BR /&gt;&lt;BR /&gt;In cases like this I usually let the system clock work for me.&lt;BR /&gt;Mind: use SEPARATE F$CVT calls!&lt;BR /&gt;Note: spacing around single &amp;amp; double quotes for readability only. Remove in code.&lt;BR /&gt;$ one = f$cvtime( "" ,, " hundredth " )&lt;BR /&gt;$ two = f$cvtime( "" ,, " second " )&lt;BR /&gt;$! need odd number of digits:&lt;BR /&gt;$ two = f$extract(1,1, " ' ' two ' " )&lt;BR /&gt;$ three = f$cvtime( "" ,, " hundredth " )&lt;BR /&gt;$ wait 0:0:0. ' two '&lt;BR /&gt;$ four = f$cvtime( "" ,, " hundredth " )&lt;BR /&gt;$&lt;BR /&gt;$ rand = " ' ' one' ' ' two ' ' ' three ' ' ' four ' "&lt;BR /&gt;&lt;BR /&gt;Make this a subroutine, and re-activate at each need of rand&lt;BR /&gt;&lt;BR /&gt;hth&lt;BR /&gt;&lt;BR /&gt;Proost.&lt;BR /&gt;&lt;BR /&gt;Have one on me.&lt;BR /&gt;&lt;BR /&gt;jpe&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 17 Jun 2005 06:21:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/generating-a-random-number-in-dcl/m-p/4907800#M32318</guid>
      <dc:creator>Jan van den Ende</dc:creator>
      <dc:date>2005-06-17T06:21:34Z</dc:date>
    </item>
    <item>
      <title>Re: Generating a random number in DCL</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/generating-a-random-number-in-dcl/m-p/4907801#M32319</link>
      <description>&lt;BR /&gt;Watch out (sic) using just the clock, of system page faults, or such as a seed, as it may readily result in steady progression in the low order digits.&lt;BR /&gt;&lt;BR /&gt;------ from an old note by 'mulp' ----------&lt;BR /&gt;The following seems to be the best compromise between performance and the&lt;BR /&gt;generally accepted recommendations.  While the top two bits are discarded,&lt;BR /&gt;the next 5-10 bits are used for calculating a number from 0 to range-1.&lt;BR /&gt;&lt;BR /&gt;$ seed = seed*69069 + 1         ! alternate $ seed = seed*987654317 + 1&lt;BR /&gt;$ value = (seed.and.%x3FFFFFFF)/(%x40000000/range)&lt;BR /&gt; ---------------------------------------&lt;BR /&gt;If you want repeatable random, then pick the same seed every time. If not, seed with time or pagefaults, or whatever.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;hth,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 17 Jun 2005 06:39:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/generating-a-random-number-in-dcl/m-p/4907801#M32319</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2005-06-17T06:39:23Z</dc:date>
    </item>
    <item>
      <title>Re: Generating a random number in DCL</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/generating-a-random-number-in-dcl/m-p/4907802#M32320</link>
      <description>I once 'found' the attached DCL routine, which incorporates a random generator, pls. read&lt;BR /&gt;the comments at the beginning.&lt;BR /&gt;&lt;BR /&gt;regards Kalle</description>
      <pubDate>Fri, 17 Jun 2005 06:51:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/generating-a-random-number-in-dcl/m-p/4907802#M32320</guid>
      <dc:creator>Karl Rohwedder</dc:creator>
      <dc:date>2005-06-17T06:51:44Z</dc:date>
    </item>
    <item>
      <title>Re: Generating a random number in DCL</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/generating-a-random-number-in-dcl/m-p/4907803#M32321</link>
      <description>Thanks for your help guys.&lt;BR /&gt;Niall.</description>
      <pubDate>Fri, 17 Jun 2005 07:00:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/generating-a-random-number-in-dcl/m-p/4907803#M32321</guid>
      <dc:creator>Niall Godwin</dc:creator>
      <dc:date>2005-06-17T07:00:43Z</dc:date>
    </item>
    <item>
      <title>Re: Generating a random number in DCL</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/generating-a-random-number-in-dcl/m-p/4907804#M32322</link>
      <description>The clock solution is the simplest, and provides sufficient randomness for my needs.&lt;BR /&gt;</description>
      <pubDate>Fri, 17 Jun 2005 07:06:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/generating-a-random-number-in-dcl/m-p/4907804#M32322</guid>
      <dc:creator>Niall Godwin</dc:creator>
      <dc:date>2005-06-17T07:06:18Z</dc:date>
    </item>
  </channel>
</rss>

