Xref: utzoo comp.sys.transputer:1949 comp.lang.fortran:3551 Path: utzoo!attcan!uunet!mcsun!ukc!edcastle!simon From: simon@castle.ed.ac.uk (Simon Brown) Newsgroups: comp.sys.transputer,comp.lang.fortran Subject: Re: Random numbers Message-ID: <5540@castle.ed.ac.uk> Date: 6 Aug 90 10:38:01 GMT References: <139529@sun.Eng.Sun.COM> <528@keele.keele.ac.uk> Organization: Meiko Ltd. Lines: 35 In article <528@keele.keele.ac.uk> cca04@keele.ac.uk (P.J. Mitchell) writes: >From article <139529@sun.Eng.Sun.COM>, by mrm@loglady.Eng.Sun.COM (Marianne Mueller): >> See also Park & Miller, "Random Number Generators: Good Ones Are Hard >> to Find", CACM, Vol 31, No 10, Oct 1988, 1192-1201. > >Well people, thanks for nothing ! All I've had is references like the above >or really useful comments like use the BSD random() function. > >Was my posting not clear enough for you ? I said that I am using Meiko C and >fortran and Meiko supply rand()/srand(). Not one person actually answered my >question about how to use *these* functions ! I was just told not to. > In both the RTE and MEiKOS C environments, the following are provided: a) `Traditional' 16-bit V7 randomness: extern int rand (void); extern void srand (unsigned int seed); b) Berkeley-style randomness: extern long random (void); extern void srandom (unsigned int seed); c) Double-precision randomness (in the math library "-lm"): extern double drand48 (void); extern void srand48 (unsigned long seed); These can be called from Fortran by using their names with a prepended underscore (and using %VAL to ensure that the correct parameter calling sequence is used). Link from Fortran using the "-lc" library. ------------------------------------------------------------------------------- Simon Brown simon@meiko.co.uk Meiko Scientific Ltd. simon@uk.ac.ed (EPCC, Univeristy of Edinburgh) simon%ed.ac.uk@nsfnet-relay.ac.uk