- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
                        查看更多
                        
                    
                vb生成不重复的随机数(VB generates random numbers that are not repeated)
                    vb生成不重复的随机数(VB generates random numbers that are not repeated)
VB generates random numbers that are not repeated
My suggestion is: the first step, first make a deposit on the array, the number 35 (which may not be continuous, can also be a string of names, what); the second step, generates a random number between 1-35 and output; the third step: the first element of the array and the number of pay in the fourth step, the output from the array; the 2-35 between second randomly selected number; fifth step, the second unit second random number and the array this call number; the sixth step, a random sample of third output..... Repeat to draw a random number between the 35-35 numbers, then direct the last one.
The program is as follows (VB6):
On the default form in the project, draw a Command1, paste program:
Option explicit
Private vArray (1, to, 35) as currency defines the number of arrays
Private, sub, command1_click ()
Test
End Sub
Private, sub, InitArray ()
Dim I as long
Assign an array
For i=1 to 35
Varray (I) =i
Next I
End Sub
Private, sub, Test ()
Dim iStart as long
Dim iPos as long
Dim vTemp as currency
Dim sReturn as string
InitArray
Randomize timer sets random factors so that the random number of programs they run every time is different
IStart=1
Do
IPos=int (rnd* (UBound (vArray), -iStart+1)) +iStart produces an integer between iStart and 35 (35 taken from vArrays superscript)
SReturn=sReturn  vArray (iPos)  vbcrlf output
Unit content
VTemp=vArray (iStart)
VArray (iStart) =vArray (iPos)
VArray (iPos) =vTemp
IStart=iStart+1 next time it is randomly generated, one less is generated
If iStart=ubound (vArray) then
The last one, the direct output
SReturn=sReturn  vArray (UBound (vArray))
Exit Do
End if
If iStart7 then exit do if you need to generate several numbers, change 7 to several, greater than the number of array elements, and the number of elements that will output the speed (this example is 35)
Loop
Msgbox sReturnmsgbox output results
End Sub
============
                您可能关注的文档
- oracle 锁机制42(Oracle锁机制42).doc
- ofdm基本原理及应用(Fundamentals and applications of OFDM).doc
- oracle_11gr2_11 事务transaction - 四大特性(原子性,一致性,隔离性,永久性)和相应的例子来演示(oracle _ 11gr2 _ 11 事务transaction - 四大特性 (原子性, 一致性, 隔离性, 和相应的例子来演示 永久性)).doc
- oracle中如何删除重复数据(How to delete duplicate data in Oracle).doc
- oracle删除重复记录(Oracle deletes duplicate records).doc
- oracle事务(oracle事务).doc
- oracle去重复数据(Oracle to repeat data).doc
- oracle学习目标(oracle学习目标).doc
- oracle sql loader 的使用方法(Oracle SQL Loader的使用方法).doc
- oracle常用语法(Oracle common syntax).doc
- vc 编程 两类典型的 lnk2001错误分析及解决方法(VC programming two typical LNK2001 error analysis and solving method).doc
- vb绘图(VB drawing).doc
- vc 编程_两类典型的__lnk2001错误分析及解决方法(VC programming _ two typical __lnk2001 error analysis and solving method).doc
- vc 窗口大小 限制窗口大小(The VC window size limits the size of the window).doc
- vc++编程 两类典型的 lnk2001错误分析及解决方法(Vc++ programming two typical LNK2001 error analysis and Solutions).doc
- vc中操作ini文件的api(API that operates INI files in VC).doc
- vba编程规则及方法技巧(VBA programming rules and methods).doc
- vesda基本知识(VESDA basic knowledge).doc
- velocity语法(Velocity syntax).doc
- vf程序填空2(The VF program in 2).doc
最近下载
- 第十二课 冲动来袭时 课件 鄂教版八年级 心理健康教育.ppt VIP
- 2025年中国移动面试题目及答案.doc VIP
- 六年级数学下册典型例题系列之第二单元百分数(二)的应用题拓展篇(解析版).doc VIP
- 西工大计算机操作系统实验-创建GeekOS内核线程资.doc VIP
- 拉伸强度原始记录模板.xls VIP
- 近代科学进入中国的回顾与前瞻(杨振宁)高中语文必修2.ppt VIP
- 社区卫生院卫生服务中心制度管理办法方案汇编.docx VIP
- DB15T 3962.4-2025绿色矿山建设规范 第4部分:煤炭行业.pdf VIP
- TCS-900 SISPatch使用手册相关资料文档.pdf VIP
- 《交通安全教育》课件.ppt VIP
 原创力文档
原创力文档 
                         
                                    

文档评论(0)