我要随机产生5000个英文和数字混合的八位数.
如果谁有这种软件,看能否帮忙生成一下.发给我
我要随机产生5000个英文和数字混合的八位数.
如果谁有这种软件,看能否帮忙生成一下.发给我
VBA代码如下,按alt+F11,在sheet1中双击,粘贴。
工具 宏 运行宏。执行aaa即可。
Sub aaa()
For i = 1 To 5000
bb = ""
aa = ""
For j = 1 To 8
a = VBA.Int(Rnd() * 3 + 1)
Select Case a
Case Is = 1
bb = Chr(64 + Int(Rnd * 26) + 1)
Case Is = 2
bb = Chr(96 + Int(Rnd * 26) + 1)
Case Is = 3
bb = Int(Rnd() * 9 + 1)
End Select
aa = aa & bb
Cells(i, 1) = aa
Next j
Next i
End Sub
在EXCEL中如何使用随机函数生成8位数字或者数字与字母混合的密码,首尾可以为数字0:
数字密码 =TEXT(INT(RAND()*100000000),"00000000") 混合密码 b1至b36依次填充0-9,A-Z a1=INDEX(B:B,RAND()*37)&INDEX(B:B,RAND()*37)&INDEX(B:B,RAND()*37)&INDEX(B:B,RAND()*37)&INDEX(B:B,RAND()*37)&INDEX(B:B,RAND()*37)&INDEX(B:B,RAND()*37)&INDEX(B:B,RAND()*37) 如不满意,按F9重算。
我的方法跟楼上的相似,只是分步进行了,较容易理解,而且也解决了其它符号的问题,
第一行随机生成大写字母:=CHAr(RANDBETWEEN(65,90))
第二行随机生成小写字母:=CHAr(RANDBETWEEN(97,122))
第三行随机生成数字:=RANDBETWEEN(0,9)
然后从上面生成的随机数中提取了一个数:=INDEX($C$1:$J$3,RANDBETWEEN(1,3),RANDBETWEEN(1,8))
再把随机生成的数据组合起来形成8位数:=INDEX($C$1:$J$3,RANDBETWEEN(1,3),RANDBETWEEN(1,8))&INDEX($C$1:$J$3,RANDBETWEEN(1,3),RANDBETWEEN(1,8))&INDEX($C$1:$J$3,RANDBETWEEN(1,3),RANDBETWEEN(1,8))&INDEX($C$1:$J$3,RANDBETWEEN(1,3),RANDBETWEEN(1,8))&INDEX($C$1:$J$3,RANDBETWEEN(1,3),RANDBETWEEN(1,8))&INDEX($C$1:$J$3,RANDBETWEEN(1,3),RANDBETWEEN(1,8))&INDEX($C$1:$J$3,RANDBETWEEN(1,3),RANDBETWEEN(1,8))&INDEX($C$1:$J$3,RANDBETWEEN(1,3),RANDBETWEEN(1,8))
这个看来很长,但都是8个重复的,复制一个粘贴8次就行了
另外这5000个数据我已经做好了,你要的话我直接发给你就行了