[comp.lang.pascal] Random numbers in TML Pascal

cc@xroads.UUCP (Dan McGuirk) (03/09/88)

Does anyone know of a way to generate a random number in TML Pascal?  There
appears to be no 'random' function, and I can't find anything in the manual
about it..[or about anything, for that matter..the manual seems to be pretty
worthless to me]  Is there a command built in to TML to do this or am I going
to have to use a completely external procedure?

Thanks in advance..

Dan McGuirk
ihnp4!crash!xroads!cc
-- 
\  /  C r o s s r o a d s  C o m m u n i c a t i o n s
 \/   (602) 971-2240
 /\   (602) 992-5007 300|1200 Baud 24 hrs/day
/  \  ihnp4!crash!xroads!*

douglas@reed.UUCP (P Douglas Reeder) (03/11/88)

You can easily write your own, if you like, with the following equations:

seed := (seed*a + c) mod m
random := seed/m

One good set of numbers to use is: a=62605,c=113218009,m=536870912
A good first seed is 7774755.


-- 
Doug Reeder            USENET: ...!tektronix!reed!douglas
Box 502 Reed College   BITNET: douglas@reed.UUCP
3203 S.E. Woodstock      ARPA: !tektronix!reed!douglas@Berkley
Portland, OR 97202   UNIVERSE: Local Group,Milky Way,Sol III,122 38'W 45 28'N