Created
July 21, 2018 09:24
-
-
Save OhkuboSGMS/7af9132ce4e253b248f048b962bd53f8 to your computer and use it in GitHub Desktop.
適当に英字を生成(using LINQ)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Linq; | |
using Random = UnityEngine.Random; | |
public class DummyString | |
{ | |
public static string Generate(int length) | |
{ | |
return new string(Enumerable.Range(0, length).Select(i => Generate()).ToArray()); | |
} | |
public static char Generate() | |
{ | |
return _table[Random.Range(0,_table.Length)]; | |
} | |
private const string _table ="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment