pascal/school/randomness.pas · 784 字节 · 下载原文
unit randomness;
// ⚠ 语料整理说明:本文件取自 `19. Units/randomness.pas`,摊平进 school/ 时曾被改名成
// `lesson19_2_3.pas`,于是同目录的 `lesson19.pas` 里 `uses randomness;` 找不到单元
// (FPC 与本编译器都按「<单元名>.pas」解析)⇒ 现恢复原名,源码正文一字未改。
// a unit's interface is available to the public
interface
function getRandomNumber(): Integer;
// a list of the functions makes them usable outside of the unit
// a unit's implementation is only available to the programmer
// of the unit
implementation
function getRandomNumber(): Integer;
// a definition of a routine must only be in implementation
begin
getRandomNumber := 3
// chosen from a die, this is a random number ;)
end;
end.