- 1、本文档共14页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 5、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 6、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 7、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 8、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
最近下载
- 中华民族共同体概论课件第八讲共奉中国与中华民族聚力发展.pptx VIP
- 一种碱性磷酸酶标记抗体或抗原的方法.pdf VIP
- 2024-2025部编人教版小学语文1一年级上册(全册)优秀课件.ppt
- 手术室PDCA——提高急诊手术器械物品准备的完善率.pptx VIP
- 宠物行业宠物智能喂食器研发方案.doc VIP
- 老年人徒手肌力评定健康促进课件.pptx VIP
- TPM管理培训课件.pptx VIP
- 中华民族共同体概论大讲堂课件第七讲华夷一体与中华民族空前繁盛(隋唐五代时期).pdf VIP
- 灰库系统钢结构加固施工方案.docx VIP
- 2025至2030中国中医馆行业市场发展分析及前景趋势与投资机会报告.docx
文档评论(0)