加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

[VB.NET]随机函数得到数字和字母组合

发布时间:2020-12-16 23:59:04 所属栏目:大数据 来源:网络整理
导读:Private Shared constant As Char ()={ "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,
  1. 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}
  2. PrivateFunctionGenerateRandom(ByValLengthAsInteger)AsString
  3. DimnewRandomAsSystem.Text.StringBuilder=NewSystem.Text.StringBuilder(62)
  4. DimrdAsRandom=NewRandom
  5. DimiAsInteger=0
  6. Whilei<Length
  7. newRandom.Append(constant(rd.Next(62)))
  8. System.Math.Min(System.Threading.Interlocked.Increment(i),i-1)
  9. EndWhile
  10. ReturnnewRandom.ToString
  11. EndFunction

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读