Hi!
According to Christian Bockermann:
I'm not sure, if this is the right place for my question, but I don't know where else to look for help. So, if this is not the right way, please appologize.
This is absolutely the right place. Welcome to the GNU Pascal mailing list! :)
My actual problem is that I don't find any procedures of functions to get randomized numbers. I tried "randomize" and "random(n)" as in Turbo Pascal, but it didn't work. :-) Is there any unit perhaps, which includes such functions in GPC ? Is there perhaps something like the "CRT"-unit ?
We are currently working on a built-in `random' function. For the moment, you can use one of the following:
* On ftp://agnes.dida.physik.uni-essen.de/gnu-pascal/contrib/, you can find a "BPcompat" package that contains a `System' Unit (with `random' etc.), a `CRT', and more. While it is written to work with DJGPP (DOS), it should not be too hard to port the relevant parts to Linux. I don't know whether somebody is already working on a Linux version of this. If you would like to do something in this direction, please let us know.
* At the same location there is another package "BO5" which implements a portable `random' function and some replacement stuff for `CRT'. I am currently working on making it a complete user-interface library.
* Here is `random':
Function Rand: Integer; C; (* Use C's `rand' function. *)
Procedure InitRandom ( Seed: Integer ); asmname 'srand'; (* Replacement for `RandSeed'. *)
Function Random ( limit: Integer ): Integer;
begin (* Random *) Random:= Rand mod limit; end (* Random *);
You know how to get a real number 0 <= x < 1 out of `Rand'.
Greetings,
Peter
Dipl.-Phys. Peter Gerwinski, Essen, Germany, free physicist and programmer peter.gerwinski@uni-essen.de - http://home.pages.de/~peter.gerwinski/ [970201] maintainer GNU Pascal [970714] - http://home.pages.de/~gnu-pascal/ [970125]