vb随机函数

来源:百度知道 编辑:UC知道 时间:2024/05/18 00:13:55
如何利用VB的随机函数生成35个0到100之间没有重复的随机数

dim a(1 to 35)
randomize
for i=1 to 35
a:
a(i)=int(rnd*36)
for j=1 to i-1
if a(i)=a(j) then goto a
next j
next i

请参考这个题我的回答:
http://zhidao.baidu.com/question/12243828.html

同样是关于VB随机数生成的。

这很简单
以窗体click事件为例
dim i as integer;a(i) as integer
for i=1 to 35
randomize
a(i)=int(rnd*101)
print a(i)

dim a(34)
for i=0 to 34
a(i)=int(21*rnd)*4+int(21*rnd)
next