ranlib.pas 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. { ranlib.pas Agner Fog 2001-10-23
  2. Pascal unit for linking assembled random number generator library into
  3. Borland Delphi project.
  4. The .obj files contain assembled code optimized for speed. Works in Windows
  5. 95 and later, as well as other systems running on an Intel-compatible
  6. microprocessor in 32-bit mode.
  7. This file has been tested with Borland Delphi version 6.0. For other versions
  8. of Pascal and Delphi, you need the appropriate LINK statements to link in the
  9. .obj files and the external function declarations.
  10. Example of use:
  11. -------------------------------------------------------------------------------
  12. uses
  13. ranlib,
  14. SysUtils;
  15. var seed, i: integer;
  16. var s: string;
  17. begin
  18. seed := Round(Time()*3600000.0);
  19. WRandomInit(seed);
  20. for i := 1 to 20 do begin
  21. Writeln(WRandom(), ' ', WIRandom(0,99));
  22. end;
  23. Writeln('');
  24. Read(s);
  25. end.
  26. -------------------------------------------------------------------------------
  27. }
  28. unit ranlib;
  29. interface
  30. {link in external functions:}
  31. {$LINK motrot.obj}
  32. {$LINK mother32.obj}
  33. {$LINK ranrot32.obj}
  34. {declare external functions:}
  35. procedure XRandomInit(seed:Integer); cdecl; external;
  36. function XRandom():Double; cdecl; external;
  37. function XIRandom(min:Integer; max:Integer): Integer; cdecl; external;
  38. procedure WRandomInit(seed:Integer); cdecl; external;
  39. function WRandom():Double; cdecl; external;
  40. function WIRandom(min:Integer; max:Integer): Integer; cdecl; external;
  41. procedure MRandomInit(seed:Integer); cdecl; external;
  42. function MRandom():Double; cdecl; external;
  43. implementation
  44. end.