- 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
最近下载
- 2025中考模拟 数学(浙江卷)(答题卡).docx VIP
- 6-2 好少年在行动(课件)-《新时代中国特色社会主义思想学生读本 (小学低年级)》.pptx VIP
- 工厂VDA6.3-2023审核员培训考核试卷含答案.doc
- (建筑施工企业) 固定资产、无形资产管理制度.docx VIP
- 第二单元任务2《制作广式月饼》(教案)-2024-2025学年湘教版劳动五年级上册.docx VIP
- 代金劵模板.doc VIP
- 海洋生物学课件:中尺度涡对南海初级生产过程的影响.ppt VIP
- AI时代高校人才培养的改革与创新实践.docx
- 第6讲 做新时代的好少年(第一课时)扣好人生第一粒扣子(课件)-《学生读本(小学低年级)》.ppt VIP
- 人教版数学六年级下册全册教学课件(2025年).pptx
文档评论(0)