Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
HP.com home

HP OpenVMS Systems

Ask the Wizard
» 

HP OpenVMS Systems

OpenVMS information

» What's new on our site
» Upcoming events
» Configuration and buying assistance
» Send us your comments

HP OpenVMS systems

» OpenVMS software
» Supported Servers
» OpenVMS virtualization
» OpenVMS solutions and partners
» OpenVMS success stories
» OpenVMS service and support
» OpenVMS resources and information
» OpenVMS documentation
» Education and training

Evolving business value

» Business Systems Evolution
» AlphaServer systems transition planning
» Alpha RetainTrust program

Related links

» HP Integrity servers
» HP Alpha systems
» HP storage
» HP software
» HP products and services
» HP solutions
» HP support
disaster proof
HP Integrity server animation
Content starts here

Ask the Wizard Questions

Random Number Generator in OpenVMS VAX v6.1

The Question is:

Dear Wizards,

I have two questions, actually. The first is I am a Game Programmer and I would like to know if there is a way to get Random Numbers in OpenVMS VAX v6.1.

If there is could you mail it to me?

The second Question is I was wondering if you could send me some programs that you use. This would help me greatly, and I would love to have them.

Thank You for your time.


The Answer is:

The standard runtime library contains a routine which implements a mixed congruential method random number generator. By all accounts it's an excellent generator. Of course it's quite simple to code your own. MTH$RANDOM is only 9 machine instructions long, maybe 4 or 5 lines of code in a high level language. Check out a good textbook on the subject. Although it's very old, the definitive work is still "The Art of Computer Programming, Vol 2, Seminumerical Algorithms, Donald E. Knuth, Addison Wesley, 1969(!)"

Here's what HELP has to say about the routine:

$ help rtl mth$ mth$random

RTL_Routines

MTH$

MTH$RANDOM

The Random-Number Generator, Uniformly Distributed routine is a general random-number generator.

Format:

MTH$RANDOM seed

ARGUMENT

seed

VMS usage: longword_unsigned

type: longword (unsigned)

access: modify

mechanism: by reference

The integer seed, a 32-bit number whose high-order 24 bits are converted by MTH$RANDOM to an F_floating random number. The seed argument is the address of an unsigned longword that contains this integer seed. The seed is modified by each call to MTH$RANDOM.

Most languages implemented on OpenVMS also have their own run time library routine for generating random numbers. See your language documentation for details.


The Answer to the second question is:

I'm not sure what you're asking here - most of the programs I use regularly are commercial products. It works like this: you send us money, we send you the program (source code is extra, *LOTS* extra). If you're looking for sample programs, I'd suggest the Freeware CD, the DECUS library, DSNlink, or the various web sites.


 

** About PDF files: The PDF files on this Web site can be read online or printed using Adobe® Acrobat® Reader. If you do not have this software installed on your system, you may download it from the Adobe Web site.
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 2008 Hewlett-Packard Development Company, L.P.