Vb6 How do I make a Random String of 0-9 and a-z of x characters

后端 未结 8 1897
無奈伤痛
無奈伤痛 2021-02-14 03:29

Trying to create a random string, x characters in length using 0-9 and a-z/A-Z and can\'t seem to find a good example, any ideas?

相关标签:
8条回答
  • 2021-02-14 04:03

    Using the algorith of Vinko Vrsalovic, here is the funcionay code, thanks and cya!

    all_chars = array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","S","T","U","V","W","X","Y","Z")
    Randomize
    for i = 1 to 4
       random_index = int(Rnd()*25)
    clave = clave & all_chars(random_index) 
    next
    
    0 讨论(0)
  • 2021-02-14 04:05

    Inspired by this question I have asked a similar question where I propose using a GUID to generate the sequence. The short coming of this, as I point out, is that if there are no other flaws in my logic then it will be a random sequence of A through F and 10 digits. If you can live with the fact that letters G through Z are missing then this might be a solution for you.

    0 讨论(0)
提交回复
热议问题