哪位大哥能帮我写一个产生随机数的程序啊???急求!

gou_xp 2006-05-11 03:37:30
我想点击button时,随机产生一个数显示于edit中,哪位大哥帮帮忙啊?万分感谢!
...全文
188 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
stonezhy 2006-05-11
  • 打赏
  • 举报
回复
包括
postren 2006-05-11
  • 打赏
  • 举报
回复
function Random [ ( Range: Integer) ];

Description

In Delphi code, Random returns a random number within the range 0 <= X < Range. If Range is not specified, the result is a real-type random number within the range

0 <= X < 1.

To initialize the random number generator, add a single call Randomize or assign a value to the RandSeed variable before making any calls to Random.

Note: Because the implementation of the Random function may change between compiler versions, we do not recommend using Random for encryption or other purposes that require reproducible sequences of pseudo-random numbers.
stonezhy 2006-05-11
  • 打赏
  • 举报
回复
500 + random(1000-500)
gou_xp 2006-05-11
  • 打赏
  • 举报
回复
我想问一下,在这个数值范围内,包不包括0啊???////
csnight 2006-05-11
  • 打赏
  • 举报
回复
记得以前面试的时候,别人叫我写一个取得随机数的函数,我说我一般就用Random函数.
结果.....
今天借楼主的地方,请高人给一个取的随机数的代码
stonezhy 2006-05-11
  • 打赏
  • 举报
回复
random(1000-500)是500 到1000之间的随机数
postren 2006-05-11
  • 打赏
  • 举报
回复
(注释一下老之的)
randomize; //初始化随机种子
Edit1.Text:=IntToStr(Random(100)); //100是返回随机数的范围
老之 2006-05-11
  • 打赏
  • 举报
回复
randomize;
Edit1.Text:=IntToStr(Random(100));

16,748

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 语言基础/算法/系统设计
社区管理员
  • 语言基础/算法/系统设计社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧