Hi,
I'd like to use random numbers generator. Is someone knows some efficient procedures or functions in pascal?
Thanks a lot in advance for your help,
Nathalie
Hi, Nathalie,
you wrote:
I'd like to use random numbers generator.
Just do so. :-)
Is someone knows some efficient procedures or functions in pascal?
Yes: `Random'. Use `Randomize' to initialize the random number generator.
program foo;
begin Randomize; WriteLn (Random (42)) end.
Have fun,
Peter
Just small addition to this:
var N:any_integer_type; (may be not extended (very large) integer integer) random(N); would return integer type in the range 0..N-1
random; (without parameters) would return float in the range 0..1.
On Fri, 26 May 2000, Peter Gerwinski wrote:
Hi, Nathalie,
you wrote:
I'd like to use random numbers generator.
Just do so. :-)
Is someone knows some efficient procedures or functions in pascal?
Yes: `Random'. Use `Randomize' to initialize the random number generator.
program foo; begin Randomize; WriteLn (Random (42)) end.
Have fun,
Peter
-- http://home.pages.de/~Peter.Gerwinski/ - G-N-U GmbH: http://www.g-n-u.de Maintainer GNU Pascal - http://home.pages.de/~GNU-Pascal/ - gpc-19990118 GnuPG key fingerprint: 9E7C 0FC4 8A62 5536 1730 A932 9834 65DB 2143 9422 keys: ftp://ftp.gerwinski.de/pub/keys/ - AntiSpam: http://spam.abuse.net
Nathalie:
A compiler and system independent random generator is at:
http://www.lecb.ncifcrf.gov/~toms/delila/tstrnd.html
Note that the current gpc probably still can't handle gotos that jump to the end of the code (it's supposed to come on the next release), so it it yells about this, just remove the goto.
Tom
Dr. Thomas D. Schneider National Cancer Institute Laboratory of Experimental and Computational Biology Frederick, Maryland 21702-1201 toms@ncifcrf.gov permanent email: toms@alum.mit.edu http://www.lecb.ncifcrf.gov/~toms/