Question : unity create random string
Answered by : adventurous-ape-ntk2bpzlx5se
string RandomStringGenerator(int lenght) { string characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; string generated_string = ""; for(int i = 0; i < lenght; i++) generated_string += characters[Random.Range(0, lenght)]; return generated_string; }
Source : | Last Update : Tue, 28 Sep 21
Question : unity random string
Answered by : janole-michael
string RandomStringGenerator(int lenght) { //string st = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; string result = ""; for (int i = 0; i < lenght; i++) { char c = (char)('A' + Random.Range(0, 26)); result += c; } return result; }
Source : | Last Update : Wed, 07 Apr 21