前端之家收集整理的这篇文章主要介绍了
[VB.NET]随机函数得到数字和字母组合,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
- PrivateSharedconstantAsChar()={"0"c,"1"c,"2"c,"3"c,"4"c,"5"c,"6"c,"7"c,"8"c,"9"c,"a"c,"b"c,"c"c,"d"c,"e"c,"f"c,"g"c,"h"c,"i"c,"j"c,"k"c,"l"c,"m"c,"n"c,"o"c,"p"c,"q"c,"r"c,"s"c,"t"c,"u"c,"v"c,"w"c,"x"c,"y"c,"z"c,"A"c,"B"c,"C"c,"D"c,"E"c,"F"c,"G"c,"H"c,"I"c,"J"c,"K"c,"L"c,"M"c,"N"c,"O"c,"P"c,"Q"c,"R"c,"S"c,"T"c,"U"c,"V"c,"W"c,"X"c,"Y"c,"Z"c}
- PrivateFunctionGenerateRandom(ByValLengthAsInteger)AsString
- DimnewRandomAsSystem.Text.StringBuilder=NewSystem.Text.StringBuilder(62)
- DimrdAsRandom=NewRandom
- DimiAsInteger=0
- Whilei<Length
- newRandom.Append(constant(rd.Next(62)))
- System.Math.Min(System.Threading.Interlocked.Increment(i),i-1)
- EndWhile
- ReturnnewRandom.ToString
- EndFunction
@H_116_
403@
原文链接:https://www.f2er.com/vb/264404.html