[CSC 330] Random Number Generators

Andrew J. Pounds pounds_aj at mercer.edu
Mon Oct 26 11:46:03 EDT 2026


Class -- it dawned on me last week that the reason some of you may not 
have gotten started on the Fortran or Lisp versions of Poker is because 
you didn't know how to generate random numbers for those languages.  
While each language does in fact have its own method for generating 
random numbers, I am providing you with examples and code for how I 
implement the Park-Miller random number generator.  This is a robust 
random number generator that can easily be coded across several 
languages.  In fact, I am providing examples 
<https://theochem.mercer.edu/csc330/languages/Generic/random.html>for 
you in Fortran, Lisp, Pascal, Ada, and Rust.

If you do not have have a unique random seed you will get the same set 
of random numbers every time.  A common technique is to generate a 
random seed based on the systems date and time.  To save you time in 
having to look up all of these systems calls for date and time I am 
providing a second set of examples 
<https://theochem.mercer.edu/csc330/languages/Generic/randomSeed.html> 
that demonstrate how to "seed" the random number generator in Fortran, 
Lisp, Pascal, Ada and Rust.

Hopefully you can use these web pages and example to start building your 
card decks in the languages required for the second version of the poker 
project.

p.s. -- I pulled the initial Fortran code, which I modifed to modern 
Fortran, from a program I wrote almost 30 years ago!
-- 
*Andrew J. Pounds, Ph.D.*
/Professor of Chemistry and Computer Science/
/Director of the Computational Science Program/
/Mercer University, Macon, GA, 31207 (478) 301-5627 /
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://theochem.mercer.edu/pipermail/csc330/attachments/20261026/e23cd321/attachment.htm>


More information about the csc330 mailing list