How can I generate random alphanumeric strings?

后端 未结 30 2778
予麋鹿
予麋鹿 2020-11-22 03:17

How can I generate a random 8 character alphanumeric string in C#?

30条回答
  •  醉话见心
    2020-11-22 04:10

    I know this one is not the best way. But you can try this.

    string str = Path.GetRandomFileName(); //This method returns a random file name of 11 characters
    str = str.Replace(".","");
    Console.WriteLine("Random string: " + str);
    

提交回复
热议问题