delphi怎么实现一定范围内的随机数呢?


本文整理自网络,侵删。

 delphi怎么实现一定范围内的随机数呢?


//指定范围的随机数函数
function Rand(min,max:Integer):Integer;
begin
  randomize;
  Result:=random(max) mod (max-min+1)+min;
end;
//调用
Rand(100,1000);
显示结果是100~1000之间的随机数

相关阅读 >>

Delphi 文件查找findfirst,findnext,findclose

Delphi一个综合实用的单元

Delphi xe firemonkey的几个特色属性

Delphi控件adsl拨号和断开

Delphi 鼠标拖动控件自由移动位置

Delphi简单的播放声音

Delphi 转换swf到exe

Delphi中destroy, free, freeandnil, release用法和区别

Delphi unigrid记录check遍历

Delphi 使用twebbrowser组件保存网页为html和mht文件

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...