怎么让随机生成20位数,这20位是字母和数字在一起的.谢谢.

解决方案 »

  1.   

    Function GenKeyOne(digits)Dim GenKeyTwo
    Dim char_array(62)'需初始化数组
    Dim RandCoderandomize'生成digits位的随机字符或数字,决定于char_array数组中的内容 。
    do while len(output) < digits
    num = char_array(Int((62 - 0 + 1) * Rnd + 0))
    output = output + num
    loop
    GenKeyOne = output
    End Function
      

  2.   


    tring Vchar = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,W,X,Y,Z,0,1,2,3,4,5,6,7,8,9" ;
    string[] VcArray = Vchar.Split(',') ;
    string VNum="";
    Random rand =new Random();
    for ( int i = 1 ; i < 20 ; i++ ) 
    {    
    rand =new Random(i*temp*unchecked((int)DateTime.Now.Ticks));  
    int t =  rand.Next(35) ;
    return RndNum( VcodeNum );
    VNum += VcArray[t];
    }
    你想要的就是VNum