質問編集履歴

2

コードを見やすくしました。

2019/09/01 12:31

投稿

_Beginner
_Beginner

スコア103

test CHANGED
File without changes
test CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  //ランダムな文字列を作成
4
4
 
5
- private const string VillagerID_CHARS = "0123456789abcdefghijklmnopqrstuvwxyz";
5
+ private const string CHARS = "0123456789abcdefghijklmnopqrstuvwxyz";
6
6
 
7
7
  public static string GenerateRandomNumber(int length)
8
8
 
@@ -24,7 +24,7 @@
24
24
 
25
25
  int pos = r.Next(VillagerID_CHARS.Length);
26
26
 
27
- char c = VillagerID_CHARS[pos];
27
+ char c = CHARS[pos];
28
28
 
29
29
  sb.Append(c);
30
30
 

1

コードの修正

2019/09/01 12:31

投稿

_Beginner
_Beginner

スコア103

test CHANGED
File without changes
test CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  private const string VillagerID_CHARS = "0123456789abcdefghijklmnopqrstuvwxyz";
6
6
 
7
- public static string GenerateVillagerID(int length)
7
+ public static string GenerateRandomNumber(int length)
8
8
 
9
9
  {
10
10
 
@@ -60,7 +60,7 @@
60
60
 
61
61
  {
62
62
 
63
- str[i] = GenerateVillagerID(5);
63
+ str[i] = GenerateRandomNumber(5);
64
64
 
65
65
  Debug.Log(str[i]);
66
66